Jump to content


Cannot Modify Header Information

  • This topic is locked This topic is locked
2 replies to this topic

#1 pureDesi

  • Members
  • PipPip
  • Member
  • 19 posts

Posted 01 October 2006 - 01:59 AM

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:
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
Anybody know what's wrong?

#2 schwim

  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationWestern NC, US

Posted 01 October 2006 - 02:18 AM

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.


#3 akitchin

  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 01 October 2006 - 03:51 AM

i'm locking this topic.  read the sticky topics, as they discuss header errors in detail.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users