0

Good morning,

I have tried a lot of codes in order to unset some cookies from a simple PHP form, but it's impossible. I tried with "unset", then I tried with "setcookie with a negative date", but they are still in my browser.

How can I unset the cookies? That's how I set the cookies:

setcookie("name", $name, time()+120);

That's how I'm trying to unset the cookies:

setcookie('name',null, -1, '/');

Why they are still in my browser?

Thanks,

Regards,

2 Answers2

0

The PHP documentation has examples of.

// set the expiration date to one hour ago
setcookie ("TestCookie", "", time() - 3600);
setcookie ("TestCookie", "", time() - 3600, "/~rasmus/", "example.com", 1);

http://php.net/setcookie

Perhaps try the following, otherwise you're going to need to start inspecting the raw http request headers/responses for issues.

setcookie('name', '', time() - 3600);
Scuzzy
  • 12,186
  • 1
  • 46
  • 46
0

You should check the following links , better to search but to ask a question which has been asked before :

Link #1

Link #2

Community
  • 1
  • 1
Ph4r5h4d
  • 101
  • 2
  • 9
  • I have already searched and testes a lot of threads from Stackoverflow, but it didn't worked...! Regards, –  Mar 13 '14 at 10:31
  • Have you tested your app in another browser ? seems a problem not from code but somewhere else – Ph4r5h4d Mar 14 '14 at 13:43