title: Set cookie wih JS, read with PHP problem
body: <p>I'm trying to set a cookie with javascript and read it in an other page with php.
  I am able to write the cookie by doing</p>
  
  <pre><code>document.cookie = cookieName+"="+cookieValue;
  </code></pre>
  
  <p>and i partially works. - The cookie is written, and I am able to read it with <code>$_COOKIE[cookieName]</code> but ONLY in the same web page.</p>
  
  <p>Which is not quite usefull really. I need to read it in another page. I usually develop in asp.net and c#, so I'm preety new to php. Am I doing something wrong?</p>
  
  <p>Thank you for your time!</p>
  
  <p>EDIT1:
  both pages are in the same domain.. eg. site.com/index.php -> site.com/index2.php</p>
  
  <p>EDIT2:
  the cookie is set in one page through:</p>
  
  <pre><code>function SetCookie(cookieName,cookieValue,nDays) {
   var today = new Date();
   var expire = new Date();
   if (nDays==null || nDays==0) nDays=1;
   expire.setTime(today.getTime() + 3600000*24*nDays);
   document.cookie = cookieName+"="+escape(cookieValue)
                   + ";expires="+expire.toGMTString();
  }
  </code></pre>
  
  <p>and in another page it can not be accessed, but in that same page it can...</p>
  
  <p>EDIT3:
  i tried setting the domain and added <code>path=&lt;?php echo $_SERVER['HTTP_HOST']; ?&gt;</code> to the javascript code... still nothing.. </p>
  
  <p>EDIT4:
  so far I have..</p>
  
  <pre><code>document.cookie = cookieName+"="+escape(cookieValue)+"; expires="+expire.toGMTString()+"; path=/"+"; domain=.&lt;?php echo $_SERVER['HTTP_HOST']; ?&gt;";
  </code></pre>
  
  <p>and still i can read the cookie ONLY from the same page..</p>
  
  <p>EDIT5:
  oh.. my .. god... it was a typo all along... just needed to remove the" path=/<strong>"+"</strong>; dom..." i am so ashamed of myself right about now...
  in the meantime i also reset my cookies, so Jared now i unfortuneatly can't accept your post as anwser...
  i brought shame upon my name!!!....</p>