Why are you setting one cookie with setcookie() but setting the others
with header()? For testing reasons I presume. Get rid of the other
header() lines and just use setcookie().
Try setting $cookieExpire to time() + number of seconds (or decrease
$cookieExpire a bit - 86400 is 1 day so 864000000 is about 27 years...)
To delete a cookie, set it again (use setcookie()) with the value
parameter set to "" and everything else the same.
Use a browser such as Mozilla and set it to ask permission before a
cookie is set - you can see all the details of the cookie there, such as
the date it is due to expire. This makes it much easier to debug cookie
problems.
Hope this helps.
MK.
Craig Matthews wrote:
hello, any idea why the following code does not work?!!
<?
$cookieExpire = 864000000;
setcookie("a", "love", $cookieExpire);
header("Set-Cookie: lc=50; expires=$cookieExpire");
header("Set-Cookie: id=test; expires=$cookieExpire");
while (list ($key, $val) = each ($_COOKIE)) {
echo "$key => $val<br />\n";
}
?>
Only the last cookie, "id=test" is set. Why?
Also, how should I delete all cookies set from my website in one command?
Thanks!!
--
MeerKat