Page 1 of 1
header information
Posted: Sun Jun 25, 2006 2:01 pm
by duk
hy guys,
i need to update a cookie when is necessary but the problem is using the function setcookie(); i got problems of Cannot modify header information - headers already sent by...
my question is how can we modify a cookie when is necessary and avoiding this problem ??
thanks in advance
Posted: Sun Jun 25, 2006 2:02 pm
by feyd
don't output -- echo -- anything until after all processing has been completed.
Posted: Sun Jun 25, 2006 2:50 pm
by duk
well i have some html output... just before a echo you say ???
Posted: Sun Jun 25, 2006 6:19 pm
by tecktalkcm0391
whats your page codes?
Posted: Sun Jun 25, 2006 7:51 pm
by RobertGonzalez
Have you searched this community for your error message? This question has been asked like 10 times in the last two weeks.
You are getting the error message because you are outputting something to the browser before your call to set_cookie. The same goes for the use of the header() function and session_start(). Make sure do not send any output to the browser at all (not even a single blank space) before your call to set_cookie.
Posted: Sun Jun 25, 2006 8:07 pm
by Todd_Z
if you for some reason you aren't able to do this, use the following before ANY other code executes:
then after the set_cookie() call, run: