Re: Cookie only worked on "/" but not in any sub-directories
| From: | Richard Lynch | Date: | Sun, 12 Aug 2001 21:45:35 +0000 |
| Subject: | Re: Cookie only worked on "/" but not in any sub-directories | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62341@lists.php.net to get a copy of this message | ||
Try adding "/" after the time argument to SetCookie.
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Aaron Chan <not@specified.com>
Newsgroups: php.general
To: <php-general@lists.php.net>
Sent: Friday, August 10, 2001 6:05 PM
Subject: Cookie only worked on "/" but not in any sub-directories
> Hi,
>
> First of all, I'm very new to PHP. I tried to call setcookie() function to
> set a cookie using the following code:
>
> setcookie ("TestCookie", "Some Value", time()+3600);
> echo $TestCookie, "<BR>";
>
> It works perfectly for the root directory, but when i try to do the same
> thing in another directory called '/phptest/', it didn't work at all. I
> tried to switch on netscape's "Warn me before accepting cookie" and saw
that
> the cookie was indeed sent to the client. However, I could not read back
the
> cookie's value no matter how many times i refresh netscape. Can anyone
tell
> me what's going on?
>
> Any help would be greatly appreciated.
>
> Thanks,
> Aaron
>
>