headers already sent
Posted: Wed Dec 14, 2011 4:26 am
My code is using the header("Location:rthankyou.php"); to redirect after user has filled a form.
This is working extremely well in the lamp/wamp server but is generating error on actual server.
Error msg on actual server:
i read somewhere that headers already sent" error is usually caused by having white space before or after the opening and closing PHP tags (<?php . . . ?>).
I have no such error
Any pointers on what could be wrong.? and why is it working in wamp and not on server ?
This is working extremely well in the lamp/wamp server but is generating error on actual server.
Error msg on actual server:
line 5 code:Cannot modify header information - headers already sent by (output started at /home/****/public_html/easyblood.info/header.php:5) in
/home/****/public_html/easyblood.info/rform.php on line 110
Code: Select all
include_once ('header.php');
Code: Select all
.
<?php if (isset($_POST['submit']))
{
//some code here
if (empty($problem)) //if no problems insert into db and redirect to thankyou page
{ // Insert into DB after sanitization
require_once ('connect.php');
mysql_query("INSERT INTO pd VALUES ('$rname', '$rgender','$ryob', '$rmn','$rlocation', '$remail','$rdate' )");
$ToEmail = $remail; $EmailSubject = 'Your Membership details';
$mailheader = "From: mE.\r\n"; $mailheader .= "Reply-To: $remail.\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "<br> Congratulations ! <br><br> Your are now a Member.<br>";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");*/
header("Location:rthankyou.php"); die(); // this is line 110
}
}
?>
i read somewhere that headers already sent" error is usually caused by having white space before or after the opening and closing PHP tags (<?php . . . ?>).
I have no such error
Any pointers on what could be wrong.? and why is it working in wamp and not on server ?