PHP code triggers popup window

PHP processes form data and triggers a popup window

Page 1 of 1

1 Replies - 5060 Views - Last Post: 14 August 2009 - 07:35 PM Rate Topic: -----

#1 midasxl   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 212
  • Joined: 03-December 08

PHP code triggers popup window

Post icon  Posted 14 August 2009 - 07:29 PM

Hello and thanks for your time. I'm wondering if the following code is possible. I have a PHP page with a form on it. Upon submitting the form the PHP code should trigger a popup window based on an if/else statement. It's not quite working, so I'm wondering if is even possible. Check it out...

if( $_SESSION['code'] == $_POST['code'] && !empty($_SESSION['code'] ) ) {
   $to = "[email protected]";
   $from = "Fan of Hi Techs Local!";
   $email_subject = "Mail from Hi Techs Local Fan";
   $name = $_POST['name'];
   $email = $_POST['email'];
   $message = $_POST['message'];
   $link = $_POST['link'];
   $winchoice = $_POST['winChoice'];
   $email_body = "You have received a new message from " . $name . ". Email: " . $email . ". Message: " . $message;
   mail($to, $from, $email_subject, $email_body);
echo '<script language="Javascript">';
echo '"win1.html","Window1","menubar=no,width=430,height=360,toolbar=no")';

} else {

echo '<script language="Javascript">';
echo '"win2.html","Window1","menubar=no,width=430,height=360,toolbar=no")';
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""><!-- InstanceBegin template="/Templates/main.dwt" codeOutsideHTMLIsLocked="false" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Contact Us</title>
<!-- InstanceEndEditable -->
<link rel="stylesheet" href="style.css" media="screen" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script type="text/javascript" src="js/validate.js"></script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->


				  <div id="style" class="marksform">
<form id="submitForm" name="submitForm" method="post" action="" onsubmit="return validate_form();">
<div id="group1">
<span class="small">Please tell us your name</span></label>
<input type="text" name="name" id="name" onkeydown="inputCounter(,this.form.remName,30);" onkeyup="textCounter(,this.form.remName,30);"/>
<span class="small">Please provide your email</span></label>
<input type="text" name="email" id="email" onkeydown="inputCounter(,this.form.remEmail,30);" onkeyup="textCounter(,this.form.remEmail,30);"/>
<span class="small">Please provide a detailed message</span></label>
<textarea name="message" id="message" cols="60" rows="5" onkeydown="textCounter(this.form.message,this.form.remLen,512);" onkeyup="textCounter(this.form.message,this.form.remLen,512);"></textarea>
<div class="spacer"></div>
<div id="captcha">
<img src="captcha/captcha_code_file.php" />
<label>Security Code
<span class="small">Enter code from image</span></label>
<input type="text" name="code" id="code" />

<div class="buttons">
<button TYPE=reset NAME="resetButton" VALUE="Reset">Clear</button>
<button TYPE=submit NAME="submitbutton" VALUE="Submit">Submit</button>
<div class="spacer"></div>
<!-- InstanceEnd --></html>

Thanks for any info you may be able to provide.


Is This A Good Question/Topic? 0
  • +

Replies To: PHP code triggers popup window

#2 ShaneK   User is offline

  • require_once("brain.php"); //Fatal error :/
  • member icon

Reputation: 240
  • View blog
  • Posts: 1,224
  • Joined: 10-May 09

Re: PHP code triggers popup window

Posted 14 August 2009 - 07:35 PM

Sounds like you want Javascript. I'm guessing if something is wrong in the form you wanna pop up a window? Well, without re-submitting the form, it's not possible.

Otherwise, you could have the page the code is submitted to check whatever you want, and if you want the window, then pop it up with js or something....but that's the only way you could use PHP to do this.

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1