Possible Duplicate:
Headers already sent by PHP
Getting the following error:
"Warning: Cannot modify header information - headers already sent by (output started at..."
for the following line:
echo '<center>Current Time is '. gmdate("H:i A") . ' GMT (Greenwich Mean Time or UTC)&开发者_StackOverflowlt;br />';
If I comment it out it just throws up the error at the next echo statement. Thoughts on why PHP hates my echo statements so much?
Here is my include toward the bottom of the HTML:
<div id="saveCanForm" width="100%">
<?php include('savereport.php'); ?>
</div>
It's not the echo
statements that are the problem. It looks like you have a header
call somewhere later in the file, but you can't send headers once you output any text at all. You could either move the headers to the beginning of the script or alternatively use output buffering.
Because our echo
s are coming before you are sending the header which is not allowed. Ensure that header go before any of your output.
If you don't want to rearrange you can also use output buffering.
Headers are dealt with before there is any other output, so if you write something out then PHP can't properly send headers afterwards. At some point in your code you are giving HEAD instructions which hence fails. (There's technical reasons for this, like redirects and so forth)
Its not the echo which is the problem. It is most probably caused by a file that you have included in the .php file. Have you included a file at all? This will probably be at the top. If you included file statement is not at the top of the file make sure it is.
精彩评论