title: php and javascript cookie
body: <p>why php get cookie new value only when i refresh page twice.
  When run page first time, php do not get cookie value.</p>
  
  <p>Thanks</p>
  
  <pre><code>&lt;script type="text/javascript"&gt; 
  var name = 'test1';
  var value = '1234';
  var expirydays = '1';
  expiry = new Date();
  expiry.setDate(expiry.getDate() + expirydays);
  document.cookie = name+"="+escape(value)+";expires="+expiry.toGMTString();
  &lt;/script&gt;
  
  &lt;?php       
  print_r($_COOKIE);
  ?&gt; 
  </code></pre>