faqts : Computers : Programming : Languages : PHP : Common Problems : Cookies

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

29 of 44 people (66%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

I have tried deleting a cookie but no luck.

Jul 18th, 2000 11:59
russ uman, Joe Pietroni, Andy Lewis,


The easiest way to delete a cookie in PHP is NOT to set it to expire in 
the past - it doesn't seem to work that way.  Instead, just use 
setcookie("CookieName"); with no other arguments specified.  That will 
delete the cookie.

the above doesn't work with all browsers in all environments. i've 
found that i have to use setcookie("CookieName", "", 0, "", "", 0) to 
get the right behavior in all cases.
-russ