I am trying set a cookie on my site for an id. The cookie sets fine but I want the cookie to update if the value of the cookie changes. I am using the code below but it is not updating the value of the cookie when it changes.
I have this code on the top of every page on the site:
Thanks for any helpPHP Code:if (isset($_COOKIE['id'])) {
if ($_COOKIE['id'] != $id) setcookie("id", $id, time()+3600);
} else {
setcookie("id", $id, time()+3600, "/", ".mydomain.com", 0);
}
![]()




Bookmarks