title: PHP setcookie not working on subfolders
body: <p>I've got the following PHP code which sets a cookie called lang to the value of en.</p>
  
  <pre><code>setcookie('lang','en',time() + (86400 * 14));
  </code></pre>
  
  <p>This is sometimes set via a script on the root or sometimes inside a subfolder. I'm reading the value of the cookie from subfolders and the root like this:</p>
  
  <pre><code>echo $_COOKIE['lang'];
  </code></pre>
  
  <p>Problem i am having is that if i set the cookie from inside a subfolder, i cannot read that value. So a cookie value seems to be created for each subfolder.</p>
  
  <p>Any ideas how i can resolve this? I dont want to have a cookie for each folder for the same cookie name lang</p>
  
  <p><strong>* UPDATE *</strong></p>
  
  <p>I've changed to code to make the cookie apply to /. Does this mean that the cookie will apply to all subfolders?</p>
  
  <pre><code>setcookie('lang',$selected_language,time() + (86400 * 14),'/'); 
  </code></pre>