Sticky header function



All header commands need to be sent before you send any text, including HTML, whitespace, PHP echo/print, etc.
Try this


 $email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;

mail( "", "Feedback Form Results",
$message, "From: $email" );
header( "Location: thankyou.html" ); 
Ugh. Output Buffering (i.e. ob_start()) is not the answer to headers problems.

Nostimos said:
Do you mean that it has to be the first function in the php code?

No, I mean that it has to come before any and all output. It has to be before any echo or print function, before any HTML, and before any whitespace.
O, I thought it would work since PHP gave an example of a cookie being set after ob_start().

swirlee said:
before any whitespace.
Thats probably what you did. Try checking your script and see if there are lines before the "<?php", so that "<?php" appears as your first line
it may happend that sendmail.php is included in some other script... in that case -- you will not be able to use header() if the parent script makes an output first... use meta refresh or javascript for redirecting..