PHP not reading cookies?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Cirdan
Forum Contributor
Posts: 144
Joined: Sat Nov 01, 2008 3:20 pm

PHP not reading cookies?

Post 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?
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: PHP not reading cookies?

Post by Syntac »

setcookie() only takes effect after the page has been reloaded.
Cirdan
Forum Contributor
Posts: 144
Joined: Sat Nov 01, 2008 3:20 pm

Re: PHP not reading cookies?

Post by Cirdan »

What do you mean by reloaded?

login form -> auth.php
auth.php sets cookie
auth.php redirects to index.php
Cirdan
Forum Contributor
Posts: 144
Joined: Sat Nov 01, 2008 3:20 pm

Re: PHP not reading cookies?

Post by Cirdan »

Okay, the problem was I needed to add a path to the cookie.
Post Reply