Page 1 of 1

PHP Form with Pop Up

Posted: Fri Apr 04, 2008 1:27 am
by latoyale
I want a php form that when users click submit, up opens a pop up window confirming the information was submitted. When the pop up occurs, the information in the form should clear.

My current page changes the index page into a thank you page, plus two pop ups appear. What to do? Here is the

script on my index page:

script type="text/javascript">

<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0

window.open(theURL,winName,features);

}

//-->

</script>
<script type="text/javascript">
//<![CDATA[
function popupform(f) {
var url = "thePopupPage.html"
var width = 300;
var height = 200;
var screenX = (screen.width/2 - width/2);
var screenY = (screen.height/2 - height/2);
var features= "width=" + width + ",height=" + height;
features += ",screenX=" + screenX + ",left=" + screenX;
features += ",screenY=" + screenY +",top=" + screenY+", scrollbars=1";
f.submit();
window.close('popup test.html')
var mywin=window.open(url, "popup", features);
mywin.focus();
}
//]]>
</script>

The form code is:
<form action="mail.php" method="post" name="description" >
<b>Brief Description:</b><br>

<textarea name="description" rows="5" cols="22 "input type="text"style="margin:5px 0px;"></textarea>
<br>

(e.g: catagory,brand,size,price range)<br><br>

<DIV align="center"><input type="image" name="verify" value="Click" onclick="popupform(this.form)" src="images/btn-submit.gif"/> </DIV>
</form>


Now the code for the mail.php is:
<?php
$to = "testing@gmail.com";
$subject = "Brief Description From Homepage";
$description = $_POST['description'];
$sent = mail($to, $subject, $description) ;
?>

Lastly the code for the pop up is:

<html>
<head><meta http-equiv="Refresh"content="5;url=http://www.testing.com">
<script language="javascript">

var theURL = 'thePopupPage.html';
var width = 300;
var height = 400;

function popWindow() {
newWindow = window.open(theURL,'newWindow','toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no,width='+width+',height='+height);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Thank you </title>
</head>
<body onLoad="popWindow()"><div>
<div align="center"> Thank you for submitting your form.<br><br> In five seconds, you will be redirected to the homepage</div>
</body>
</html>

I have been trying to do this for 2 days now. Please help!! :banghead: