0
chirag posted
problem in $_COOKIE destroying in php
i am using $_COOKIE to remember some info for my website . but when i try to destroy it . it is not destroying some reason.setting cookie
setcookie("myavatar","smile.png",time()+3600);
now unsetting it by unset and setcookie
<?php if(isset($_COOKIE['myavatar'])) { ?>
<img src="<?php echo $_COOKIE['myavatar']); ?>" />
<?php
unset($_COOKIE['myavatar']);
setcookie("myavatar","",time()-3600);
} ?>
see i try unset and than setcookie to past by time()-3600
so it should be destroyed by this two function :
1. unset($_COOKIE["cookiename"]) i try to unset as we do for varable
2.setcookie("cookiename","",time()-3600); i set cookie time to remain alive to past so it will destroy that way also
so point my problem pls . i am clueless now