Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP headers already sent [duplicate]

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)<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>
like image 636
themerlinproject Avatar asked Sep 30 '26 04:09

themerlinproject


1 Answers

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.

like image 102
casablanca Avatar answered Oct 01 '26 19:10

casablanca



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!