I have a form that when submitted sends an email, and stores the user’s information in a database. If the submit is successful I would like to send users to a “Thank You” page that has the appropriate look and feel of the website. I can’t use a header() function since the headers would already have been sent on the PHP script page. Is there another approach I can use?
if(@mail($to, $subject, $body, $header))
{
header( 'Location: http://www.mydowmain.com/_test/thankyou.html' ) ;
//print ('<font size=\"2\"><b>Your Message Has Been Sent.<br>Thank You for Signing our Guestbook.</b><br><br>');
//print("<a href=\"javascript:history.go(-1);\">Return to the form</a></font><br><br>");
} else {
print ('<font size=\"2\">Output Error: Please be sure to fill in all form fields.<br>');
print("<a href=\"javascript:history.go(-1);\">Return to the form</a></font>");
}
} else {
print ('<font size=\"2\">Error! Form variables not received. Please be sure to fill in all form fields.<br>');
print("<a href=\"javascript:history.go(-1);\">Return to the form</a></font>");
}