title: android chrome Cookie set in javascript not available in PHP $_COOKIE
body: <p>I have set up an online registration form for an event for my company. I use our bank's service of collecting the credit card information, because I don't want to mess with trying secure all that. So what happens is my form collects up all the necessary data, sets a cookie, then forwards to a php page given to me by the bank, which checks the cookie set in the browser and if it's there, echoes the actual html, which then just forwards to the credit card data entry page. If the cookie hasn't been set, the page displays a message that JavaScript is needed for the page and to go back and turn it on. (Mind you, that's not my code, it came from the bank). So, here's some code snippets. I set the cookie like so:</p>
  
  <pre><code>document.cookie = "fam=barn; path=/pmtproc";
  </code></pre>
  
  <p>in a javascript function called setCookie(), and this is the only line of code in that function, except a try/catch block. Then, in the page that it gets forwarded to when submitting the form (the url in the "action" of the submitted form), the cookie is checked like so:</p>
  
  <pre><code>if (isset($_COOKIE['name'])){
      setcookie('name', '', time()-3600);
      echo $x;
  } else {
     echo ("JavaScript is needed for this page. Please go "):
     $url = htmlspecialchars($_SERVER['HTTP_REFERER']);
     echo "&lt;a href='$url'&gt;back&lt;/a&gt;"
     echo ", turn on JavaScript and try again - thanks!":
  }
  </code></pre>
  
  <p>($x contains the html for the page, which just forwards to the bank's credit card data entry site when "Javascript is set." The funniest part is that the registration form uses javascript all over the place, so they couldn't even <em>get</em> to the page where the cookie is checked if javascript wasn't enabled).</p>
  
  <p>The setCookie() function is the last thing that the function that gets called by the submit button (processForPmnt()) does before returning true. Before that, processForPmnt() adds elements from some other form(s) on the page that have individual registration data in them - the page accepts multiple registrations at once. (So basically I copy the elements on the individual forms into the form that will be submitted).</p>
  
  <p>Now, the weird part of this problem is that this works fine on desktop browsers - FF 45 and Chrome 49 on a Mac - but not on my Android phone (Chrome 49 and Android 4.4.4). I haven't tested it on anything else yet.</p>
  
  <p>I've debugged it on my phone using the remote debugging tools for Chrome, and setCookie isn't catching any exceptions or otherwise complaining. It appears to set the cookie just fine, but then when it gets to the second php page, no cookie. No cookies at all. :-(</p>
  
  <p>And the even weirder part is that I have this exact same setup in a different registration form that is live right now, and it works just fine. I set the cookie exactly the same way, in the same setCookie() function in javascript (though local to that file - I know, I know it should be in one file I include but I just haven't gotten around to doing that), then forwarding to a php file that checks the cookie using <em>exactly</em> the same code (though in a different file, so I can test the new registration without breaking the current one).</p>
  
  <p>I'm sure there's other information that would help solve the problem, so please let me know what else you need to know to help.</p>
  
  <p>It's probably something absolutely ridiculous (I've checked to make sure the setting the cookie code is identical - did a copy/paste from the working file into the not working one), I just can't see it...</p>
  
  <p>EDIT 4-6-16: I signed up for browserstack.com so I could test this on other devices/websites, and this worked just fine on a Galaxy S4 with KitKat (4.4.4), which is what my phone has (though it's a Motorola Droid Mini, but I didn't have that option) and with a Moto X 2nd Gen running Lollipop (5). It may just be my phone. But any ideas would be greatly appreciated.</p>