Reputation: 21
I'm setting a cookie like so:
setcookie ('myletter', "a", time()+60*60*24*1000, "/", ".me.com" );
Then I want to change the value so I do:
$_COOKIE['myletter'] = "b"
But the old values remains. I also tried using setcookie again, that failed too
setcookie ('myletter', "b", time()+60*60*24*1000, "/", ".me.com" );
Is there a reliable way I can actually change the value of an existing cookie?
Upvotes: 2
Views: 1289
Reputation: 17196
Fire up a tool like Fiddler that lets you see the HTML traffic between your browser and your test web server. Then look for Set-Cookie: on the response from the PHP script that sets the cookie, and then look for Cookie: in the following request. The fastest way for you to get it working is to understand cookies in terms of HTTP requests, which is summed up, though not for PHP, here - the concept is the same.
Upvotes: 4