Jump to content


This topic is now archived and is closed to further replies.


Cannot Modify Header Information

Recommended Posts

Ok, I have a problem that I'm guessing has a very simple fix. But I can't seem to find it.
This is the exact contents of the file:
setcookie("test", "", time()-30);
setcookie("test", $_GET['value'], time()+30);
echo $HTTP_COOKIE_VARS["test"];

When I run it the first time, it's fine, but then everytime after that I get the following error message:
[code]Warning: Cannot modify header information - headers already sent by (output started at /home2/monkey/public_html/main/test.php:3) in /home2/monkey/public_html/main/test.php on line 3[/code]
Anybody know what's wrong?

Share this post

Link to post
Share on other sites
Hi there,

Are you sending any POST data along with the script when the next page loads?  I got this same error when I was trying to use a user authorization script, and the explanation I found was that once headers are sent and page data starts to get passed, you can't go back and add any more header information.

One of the solutions I found was ob_start and ob_end_flush, but I have yet to make this work successfully.


Share this post

Link to post
Share on other sites
i'm locking this topic.  read the sticky topics, as they discuss header errors in detail.

Share this post

Link to post
Share on other sites
This topic is now closed to further replies.


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.