Page 1 of 1
Cookie Problem
Posted: Fri Feb 23, 2007 8:53 am
by Citizen
I have a script where a cookie is set and recalled on the same page.
The problem is, I can only recall the variable if the page is refreshed after the cookie is set.
Any ideas?
Posted: Fri Feb 23, 2007 9:55 am
by WaldoMonster
This is normal behaviour see:
http://nl2.php.net/manual/en/function.setcookie.php
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. Expire time is set via the expire parameter. A nice way to debug the existence of cookies is by simply calling print_r($_COOKIE);.
Posted: Fri Feb 23, 2007 12:50 pm
by Citizen
Thanks! I didnt know that.
Posted: Fri Feb 23, 2007 11:32 pm
by Tommy1402
hi,
i'm having trouble with how to set a cookie with Zend Framework...
any helps?
thanks a lot!
Posted: Fri Feb 23, 2007 11:38 pm
by feyd
Tommy, don't try to hijack other users' threads please.
Posted: Fri Feb 23, 2007 11:44 pm
by Tommy1402
feyd wrote:Tommy, don't try to hijack other users' threads please.
o, sorry.. I was thinking this topic also has same problem with mine.
