1

I'm using cookies on my site without expiration dates defined so they expire on the browser close but I'm having issues unsetting them. I'm using the following code to unset them but it's not correctly doing it. I should also add that I want it to remove it from all pages on the site. Any help would be greatly appreciated, thanks.

Code used to unset cookie

if (isset($_POST['logout'])) {
    unset($_COOKIE['dash']);
}

Cookie is being set like this:

setcookie("dash", $row['ID'], time() + (10 * 365 * 24 * 60 * 60), '/');
Joe Scotto
  • 10,936
  • 14
  • 66
  • 136

1 Answers1

0

I had to move the function to the top of the page before any output was sent, this fixed it.

Joe Scotto
  • 10,936
  • 14
  • 66
  • 136