First, on one page, I tried to set a cookie. <?php if (isset($_COOKIE["limited"])) echo "OLD COOKIE!"; else setcookie("limited", "true", time()+3600); echo "set"; ?> PHP: Then, on another page, I tried to delete it. <?php setcookie("limited", "true", time()-3600); if (isset($_COOKIE["limited"])) echo "still here"; else echo "gone!"; ?> PHP: I could not delete the cookie. I know that this is the problem because I am using Google Chrome where you can view all the cookies, and because the deleting script also has an if statement to check if the cookie has been deleted. What is wrong?
I think when deleting a Cookie you also need to set it's value to blank, whilst the expiration date is in the past (which you are already doing) So try something like: setcookie("limited", "", time()-3600); PHP: