Try adding "/" after the time argument to SetCookie.

WARNING [EMAIL PROTECTED] address is an endangered species -- Use
Wanna help me out?  Like Music?  Buy a CD:
Volunteer a little time:
----- Original Message -----
From: Aaron Chan <[EMAIL PROTECTED]>
Newsgroups: php.general
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
> the cookie was indeed sent to the client. However, I could not read back
> cookie's value no matter how many times i refresh netscape. Can anyone
> me what's going on?
> Any help would be greatly appreciated.
> Thanks,
> Aaron

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to