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
header information
Moderator: General Moderators
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
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.
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.
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:
Code: Select all
ob_start();Code: Select all
echo ob_get_clean();