Page 1 of 1

PHP not reading cookies?

Posted: Tue Dec 23, 2008 10:49 pm
by Cirdan
I have a script called auth.php that sets a cookie. I know for sure it is being set because I can see it in the list of cookies in FireFox. I have PHP print_r($_COOKIE) on a separate page to test it, but it does not have my cookie...any idea why?

Re: PHP not reading cookies?

Posted: Tue Dec 23, 2008 10:50 pm
by Syntac
setcookie() only takes effect after the page has been reloaded.

Re: PHP not reading cookies?

Posted: Tue Dec 23, 2008 10:54 pm
by Cirdan
What do you mean by reloaded?

login form -> auth.php
auth.php sets cookie
auth.php redirects to index.php

Re: PHP not reading cookies?

Posted: Tue Dec 23, 2008 11:45 pm
by Cirdan
Okay, the problem was I needed to add a path to the cookie.