[PHP] deleting all my cookies
I have a button that sets a variable when pressed. I then try delete any cookies using the following code but no joy. if (isset($scrub)){ echo this works; if (isset($_COOKIE['cookie'])) { foreach ($_COOKIE['cookie'] as $name = $quantity) { setcookie($name, ); } } } Please help. Any suggestions welcome. AD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] deleting all my cookies
setcookie($name,'',time()-3600); cheers On Wed, 30 Mar 2005 15:29:47 +0100, AndreaD [EMAIL PROTECTED] wrote: I have a button that sets a variable when pressed. I then try delete any cookies using the following code but no joy. if (isset($scrub)){ echo this works; if (isset($_COOKIE['cookie'])) { foreach ($_COOKIE['cookie'] as $name = $quantity) { setcookie($name, ); } } } Please help. Any suggestions welcome. AD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] deleting all my cookies
AndreaD wrote: I have a button that sets a variable when pressed. I then try delete any cookies using the following code but no joy. if (isset($scrub)){ echo this works; if (isset($_COOKIE['cookie'])) { foreach ($_COOKIE['cookie'] as $name = $quantity) { setcookie($name, ); } } } Give your cookie an expire time in the past setcookie ( $name, , time() - 3600 ); If you don't give it a time, it will be a 'session' cookie, and will remain as long as you have your browser window(s) open. http://us4.php.net/setcookie -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php