isset($_COOKIE) is not working
<p>I am using the function set cookie to set (id) cookie like so:</p>

<pre><code>$cookie_id = $insert_userid;
setcookie("id", $cookie_id, time() + 31556926, '/', 'www.example.com');
</code></pre>

<p>The code above is working fine. I am checking the setting with firefox and the correct cookie is there.
Now on my other pages on my webiste I want to check if the cookie is set.
I am using this code to redirect if the cookie is not set.
I am getting redirected in both ways weather the cookie is set or not.</p>

<pre><code>&lt;?php
if(isset($_COOKIE['id'])){
//do something.
}else{
header('Location: login.php');
}
    ?&gt;
</code></pre>

<p>how do I fix this problem ?</p>

<p>Var dump result is :</p>

<pre><code>array(4) { ["link"]=&gt; string(43) "http://www.zzz.com/zzz" ["__unam"]=&gt; string(30) "a5caeed-1385397a335-7fca86ad-2" ["PHPSESSID"]=&gt; string(26) "6khzzzzzzzzjd51i6hamm0" ["id"]=&gt; string(10) "zzzzzzzzzz" } 
</code></pre>

<p>Update: I am not checking the cookie from the same page I crated it.</p>
