I tried the above using two files. It seems like it redirects without setting the cookie first. Have you tried the above with two files? Please try it, it doesn't work for me!
Where you go wrong is in defining the domain as localhost.
The next will set an cookie for the next hour for the domain you are currently on.
<?
setcookie ("cookie", "test",time()+3600, "/"
header('Location: test2.php');
?>
To delete the cookie, set the time in the past: (Use the same parameters as you used to set the cookie)
<?
setcookie ("cookie", "test",time()-3600, "/"
header('Location: test2.php');
?>
Good luck mcvdmvs
-- "It never hurts to help" -- Eek the Cat
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.