PHP code triggers popup window

PHP processes form data and triggers a popup window

Page 1 of 1

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

#1 midasxl  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 191
  • 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...

<?php 
session_start();
if( $_SESSION['code'] == $_POST['code'] && !empty($_SESSION['code'] ) ) {
   $to = "myemail@gmail.com";
   $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 'window.open("win1.html","Window1","menubar=no,width=430,height=360,toolbar=no")';

} else {

echo '<script language="Javascript">';
echo 'window.open("win2.html","Window1","menubar=no,width=430,height=360,toolbar=no")';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<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 -->
</head>

<body>

				  <div id="style" class="marksform">
<form id="submitForm" name="submitForm" method="post" action="" onsubmit="return validate_form();">
<div id="group1">
<label>Name
<span class="small">Please tell us your name</span></label>
<input type="text" name="name" id="name" onkeydown="inputCounter(this.form.name,this.form.remName,30);" onkeyup="textCounter(this.form.name,this.form.remName,30);"/>
<label>Email
<span class="small">Please provide your email</span></label>
<input type="text" name="email" id="email" onkeydown="inputCounter(this.form.email,this.form.remEmail,30);" onkeyup="textCounter(this.form.email,this.form.remEmail,30);"/>
<label>Message
<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>
<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>
<p></p>

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



Thanks for any info you may be able to provide.

Regards,
Mark

Is This A Good Question/Topic? 0
  • +

Replies To: PHP code triggers popup window

#2 ShaneK  Icon 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.

Yours,
Shane~
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1