Page 1 of 1

Delete Cookie?

Posted: Sun Feb 16, 2003 9:35 pm
by InternetX
How can I delete a cookie that I set before with setcookie(...)?
A new cookie with the same name doesn't kill the old cookie :(
Can anyone help me?

Sorry 4 my english... I'm 14 and from Germany...

Posted: Sun Feb 16, 2003 11:20 pm
by phice
Simply set the cookie's value to nothing.

Posted: Mon Feb 17, 2003 2:35 am
by bionicdonkey
set the cookie again but change the time to a negative value so it expires
e.g.

setcookie ("TestCookie", $value,time()+3600); /* expire in 1 hour */

setcookie ("TestCookie", $value,time()-3600); /* expired 1 hour ago*/

Posted: Mon Feb 17, 2003 3:02 am
by twigletmac
setcookie():
When deleting a cookie you should assure that the expiration date is in the past, to trigger the removal mechanism in your browser.
Don't forget that you need to refresh the page before you can test for the existance or lack of the cookie.

Mac

Posted: Mon Feb 17, 2003 6:29 am
by InternetX
I already have test this...
But my cookie will not be deleted :(

I will test it again... thanks for help :)