Page 1 of 1

Help! browser refreshes twice with setcookie.

Posted: Sun Jul 18, 2004 8:30 am
by mq
I have a problem with my php code. It seems that it's making my browser referesh twice some times. That is, when I referesh the page it loads the contents, and then it reloads it again.

This happened after I added code handling another cookie (setting it). When I comment out the setcookie statment it does not reload again.

Anyone had this problem before?

Thanks.

MQ

Posted: Sun Jul 18, 2004 10:35 am
by JAM
PHP Manual Setcookie wrote: Cookies will not become visible until the next loading of a page that the cookie should be visible for. To test if a cookie was successfully set, check for the cookie on a next loading page before the cookie expires.
Might be because you are verifying the $_COOKIE in an odd way? Please do provide more info, parts of code or similiar.


feyd | fixed [/quote] ;)

Posted: Sun Jul 18, 2004 4:30 pm
by mq
It turned out that setcookie with an empty string then setting it again with some value was the problem. I removed the setcookie("mycookie", "") and it's working fine now.

Still the question holds, did anyone face this before?