Cookie Problem

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
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Cookie Problem

Post by Dale »

Ok then...

Code: Select all

setcookie(&quote;dalehaygame&quote;, &quote;Blue Bell&quote;, $time+3600);
Makes the cookie...

Code: Select all

$_COOKIE['dalehaygame'];
Shows the cookie value (eg; Blue Bell)

Code: Select all

setcookie("dalehaygame", "", $time-3600);
Breaks the cookie. However if i then go back to the page with the cookie being shown, I still get told it's Blue Bell. Why?
Last edited by Dale on Tue Jun 21, 2005 4:12 pm, edited 2 times in total.
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Why in gods name have you tried to escape the second argument !?! :?

... but seriously ... why?
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

maybe a forum bug? It's done it to me before.
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

The answer to this is likely _CACHE_ either way, when you step back, Mr. Cache wakes up with his supermutant memory which remembers that pages, and instead of updating it again he let's you read his mind.
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

Huh?
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

You've all lost me... please can i have some help with this cookie problem... it's doing my head in.
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

The only thing I can think of, assuming you've addressed the point that syranide mentioned, is that you aren't trying to delete the cookie with the same arguments that you set it with. Now, I know that in the snippets you provided argument count was the same, but maybe in your code it's not ?

If not, maybe some of the comments on http://php.net/setcookie will have an answer.
Post Reply