Menu
Hello
I want to set cookies.
But I’ve got a problem.
This code doesn’t work:
[code=php]
<?php
if (isset($_COOKIE[“myCookie”, true])) {
echo ‘
<script>alert(“You already have a cookie”);</script>
‘;
} else {
setcookie(“myCookie” , true);
echo ‘
<script>alert(“New cookie is set”);</script>
‘;
}
?>
It always alert “New cookie is set”.
I think I’ve got a problem with checking/setting the cookie.
And I really can’t find the problem.
Can someone help me?
Thanks for reading,
Niely