Re: Why does this not work??
| From: | CC Zona | Date: | Mon, 22 Apr 2002 22:38:05 +0000 |
| Subject: | Re: Why does this not work?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94081@lists.php.net to get a copy of this message | ||
In article <F9eZ1gycAnQGohj5pFU000273a0@hotmail.com>,
meaje@msn.com (Jeffrey Means) wrote:
> In using the setcookie function I can not set a cookie if I specify a time
> period. ie. setcookie("Cookie_Name", "Cookie_Value", time()+30); will not
> set a cookie, but setcookie("Cookie_Name", "Cookie_Value"); does work.
> What
> am I dooing wrong??
You need to read the docs more carefully, because time() returns a value in
seconds, not minutes. Your time period is too short: the cookie expires 30
seconds after having been set. Whereas when you set no expiration, the
cookie remains set until the window closes.
--
CC