How do you get a php cookie on a ohter page than where he is set?
example:
Cookie starts on page: index1.php
<?php
$cookiewaarde = 'example' ;
setcookie("cookiename", $cookiewaarde, time()+ 3600);
?>
Cookie will get on page: index2.php
<?
if($_COOKIE['cookiename'] != "example")
{
echo "cookie is set";
}
else
{
echo 'cookie is not set' ;
}
?>
But i cant find anny cookie on page index2.php. How can i do this??
If that’s the exact code you’re using – you’re checking to see if the cookie exists with a value of ‘mobiel’, yet you’re actually setting the value as ‘example’. On top of that, both cookies have differently spelled names, so won’t match anyway.