note 17139 deleted from function.setcookie by jimw

From: Date: Mon, 17 Dec 2001 22:46:47 +0000
Subject: note 17139 deleted from function.setcookie by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23052@lists.php.net to get a copy of this message
After months of not even realizing it ... if you do a : setcookie ("mycookie", "myvalue", "time()+3600"); that should technically set a cookie for an hour right? WRONG!!! And ... if you do a : setcookie ("mycookie", "myvalue", time()+3600); that should definitely not work as others have tried it and it craps out and wont even set the cookie ... so what's the solution? well , for all your cookie issues to be solved, whether you're using an array, or just a basically storage method, and you actually WANT the cookie to last as long as you define it for (btw ... you should note, that if you do any of the above declarations, you are infact setting an uplink session to the browser ONLY ... the cookie will work, but is not accessible from other windows, and will immediately die if you close the window you created it from ... ), then you should just do the following ... god for sakes :) $mytime = time()+3600 // or whatever you want ... setcookie ("mycookie", $val, $mytime); and it will work marvelously ... ARG!!! I spent so long figuring that out :) hope that helps you all

« previous php.notes (#23052) next »