moondance
08-19-2003, 09:18 AM
I have a simple customer form.
The forms action is mail.php, a script that will process and send the mail to my email address.
Is there a way to include in this php script a small, self-closing "thank you" window? Whenever i try i get the warning that "the header information has already been sent" - because i use header - location to take the user back to the form page.
Anyway around this?
heres my mail.php
<?
//Contents of form
$name=$_POST['Name'];
$company = $_POST['Company'];
$email=$_POST['Email'];
$message=$_POST['Message'];
//Declare the variables
$recipient = "someone@somewhere.co.uk";
$subject = "Form Submission";
$content = "The user $name from $company just filled in the contact form from the website. Their return email address is $email and they said: $message";
//mail() function sends the mail
mail($recipient,$subject,$content,$email);
//This line returns to contact page
header("Location: http://www.mycompany.co.uk/contact.htm");
?>
So i was wondering if i could put this in the above script somewhere (or if theres no equivalent php function).
<script language = "javascript">
function popMe()
{
window.open("thanks.html", "", width ="250", height = "300", status=yes, toolbar=no,menubar=no")
}
</script>
<body onload = "popMe()">
Then in the thanks.html page, to make it self-close:
<script language = "Javascript">
function closeMe()
{
setTimeout("self.close()",2000);
}
window.onload=closeMe()
</script>
Thanks for the help
The forms action is mail.php, a script that will process and send the mail to my email address.
Is there a way to include in this php script a small, self-closing "thank you" window? Whenever i try i get the warning that "the header information has already been sent" - because i use header - location to take the user back to the form page.
Anyway around this?
heres my mail.php
<?
//Contents of form
$name=$_POST['Name'];
$company = $_POST['Company'];
$email=$_POST['Email'];
$message=$_POST['Message'];
//Declare the variables
$recipient = "someone@somewhere.co.uk";
$subject = "Form Submission";
$content = "The user $name from $company just filled in the contact form from the website. Their return email address is $email and they said: $message";
//mail() function sends the mail
mail($recipient,$subject,$content,$email);
//This line returns to contact page
header("Location: http://www.mycompany.co.uk/contact.htm");
?>
So i was wondering if i could put this in the above script somewhere (or if theres no equivalent php function).
<script language = "javascript">
function popMe()
{
window.open("thanks.html", "", width ="250", height = "300", status=yes, toolbar=no,menubar=no")
}
</script>
<body onload = "popMe()">
Then in the thanks.html page, to make it self-close:
<script language = "Javascript">
function closeMe()
{
setTimeout("self.close()",2000);
}
window.onload=closeMe()
</script>
Thanks for the help