Page 1 of 1
is it possible to delete a cookie?
Posted: Wed May 19, 2004 7:13 pm
by snpo123
hey, i have set 2 cookies that make a user logged in, and I want to create a logout page that deletes those cookies. i know i can just set all the cookies values to 0, but that has giving me complications in the past. Is there any way to delete a cookie besides just setting all its values to 0? thanks.
Posted: Wed May 19, 2004 7:20 pm
by markl999
http://php.net/setcookie
Example 2. setcookie() delete example, should work fine.
Posted: Wed May 19, 2004 7:26 pm
by Joe
Marks suggestion is best but its also possible with the use of javascript. Its less efficient but works great:
javascript:void(document.cookie="")
notice im using "" to set the cookie to null.

Posted: Wed May 19, 2004 7:38 pm
by feyd
Joe's example will set all cookies available to the current page to null.. not just a specific one. be warned
Posted: Wed May 19, 2004 8:27 pm
by tim
uses marks suggestion