Forum Moderators: coopster

Message Too Old, No Replies

Problem with cookies and header

php

         

4ior

5:54 pm on Apr 27, 2006 (gmt 0)

10+ Year Member



I want to create a cookie:
setcookie("username",$username,time()+120);
setcookie("password",$crypt,time()+120);

The error:

Warning: Cannot modify header information - headers already sent by (output started at #*$!.functions.php:1) in xxx.functions.php on line 39

Warning: Cannot modify header information - headers already sent by (output started at xxx.functions.php:1) in xxx.functions.php on line 40

what should i do?
why do i get this error?

JohnCanyon

8:02 pm on Apr 27, 2006 (gmt 0)

10+ Year Member



You must use setcookie before anything is sent to the browser, this includes whitespace.

Possible issues...

you may have whitespace or html before your <?php tag, you may have an error or warning being output to the browser or you may have some other information being echo'd or printed before your setcookie is being called.

J

shankimout

8:41 pm on Apr 27, 2006 (gmt 0)

10+ Year Member



if you are useing unicode codepage you editor maybe write 3 char for starting unicode document , you have to open your document in non unicode application and remove these 3 characters

4ior

4:19 am on Apr 28, 2006 (gmt 0)

10+ Year Member



" You must use setcookie before anything is sent to the browser, this includes whitespace."

thank you, that helped