Forum Moderators: coopster
I had a page that was working perfectly fine, but now all of a sudden when i go to the page i get an error saying:
Warning: Cannot modify header information - headers already sent
However, the actuall site still functions correctly. Is there anyway i can disable this error to be displayed within the script itself?
any advise would be appreciated.
thanks in advance
i tried putting the following:
<?php
@;
?>
but it doesnt work
Try
<?php
echo 'a';
header("Location: [yahoo.com");...]
?>
then try
<?php
echo 'a';
@header("Location: [yahoo.com");...]
?>
You have to output HTTP headers *before* you output anything else. Make sure there are no echo or print statements, HTML, or even spaces or line breaks (outside of the php tags) anywhere above the section where you output the headers.
HTH
any ideas?
and/or below this: ?>
If so, remove them.
BTW, the @ should have worked. If there are no blank spaces/lines to remove, then find the header commands in your script and prepend an @ symbol on them. What was posted here was merely an example to show how to do this. Those two lines posted here are not supposed to be added...just the the @ symbol on your current header(s). There's a couple other ways to suppress the warning output, but you really should work to resolve the problem instead of just suppressing the warning.
HEADER must be send before BODY, echo a will create the BODY so it must be after HEADER
or use meta refresh. easy. :)