LaRoza Posted May 1, 2007 Share Posted May 1, 2007 I am having trouble with cookies. I can set the cookie and read it value, but I can not delete it. Could anyone tell me the proper way to delete a cookie, this cookie in particular: setcookie('created','1',time()+3600); Thank you! Quote Link to comment Share on other sites More sharing options...
taith Posted May 1, 2007 Share Posted May 1, 2007 <? function destroycookie($name){ setcookie("$name", "", time()-3600); } destroycookie('created'); ?> Quote Link to comment Share on other sites More sharing options...
LaRoza Posted May 1, 2007 Author Share Posted May 1, 2007 Does it have to be on the same page on which the cookie is set? I can use the function if it is only on the same page; however, it fails to delete it if it is on another. Quote Link to comment Share on other sites More sharing options...
taith Posted May 1, 2007 Share Posted May 1, 2007 it shouldnt matter which page your removing the cookie from... as long as you have access to the function... or just use the bare essentials from it... setcookie('created', "", time()-3600); that works just as well... basically your just setting a blank cookie overtop of the old one, that expired an hour ago(immediatly)... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.