I'm trying this code:
<?php
    $cookie_name = "idmarket";
    $coolie_value = "1";
    if (!isset($_COOKIE[$cookie_name])){
        echo "Cookie wasn't set";
        setcookie($cookie_name,$coolie_value,time() + 86400);
        echo "Now cookie set : " . $_COOKIE[$cookie_name];
    } else {
        echo "Cookie have been set : ".$_COOKIE[$cookie_name];
    }
?>
I want to do something if the cookie is not set and do nothing if it's set. but when I try to test if the cookie now is set and echo $_COOKIE[$cookie_name] I get Notice: Undefined index: idmarket instead.
 
    