title: Receiving error after setting a cookie and calling it
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3230133/accessing-cookie-immediately-after-setcookie">Accessing $_COOKIE immediately after setcookie()</a>  </p>
  </blockquote>
  
  
  
  <p>So I am using the following code below to add multilingual features to my site:</p>
  
  <pre><code>if(isset($_GET['lang']) &amp;&amp; $_GET['lang'] != ""){
  setcookie("lang", $lang, time()+360*360*3600);
  }elseif(!isset($_COOKIE["lang"]) || $_COOKIE["lang"] == ""){
  setcookie("lang", "en", time()+360*360*3600);
  }
  include 'lang/'.$_COOKIE["lang"].'.php';
  </code></pre>
  
  <p>Now when this code gets executed the first time it fails to find the `$_COOKIE["lang"] and therefore fails to open the file, however after when I refresh the page it loads just fine.
  I was wondering what I am doing wrong?</p>