cookie and header error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

cookie and header error

Post by m2babaey »

Hi
is setting cookie sending output?
I get this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/pw64/public_html/sitesaz/regt.php:8) in /home/pw64/public_html/members/saleconfirmed.php on line 37
line 37 is :

Code: Select all

36  $past = time() - 3600; 
37  setcookie('refferer', $userid, $past);
and i cannot chage this line or line 8. is there a solution?
User avatar
thomas777neo
Forum Contributor
Posts: 214
Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa

Re: cookie and header error

Post by thomas777neo »

Looks like you are printing information before you actually set the cookie. Have it that the cookie is the first thing that is created, then print the other information as usual
Post Reply