title: Why doesn't my PHP code echo out $_POST data?
body: <p>The XHR Request shown here is sending an array to process.php. The array just contains strings ex.['hello', 'name']. </p>
  
  <pre><code>var xmlHTTP;
  if (window.XMLHttpRequest)
  {
      xmlHTTP = new XMLHttpRequest();
  }
  else
  {
      xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlHTTP.onreadystatechange = function ()
  {
      if (xmlHTTP.readyState == 4 &amp;&amp; xmlHTTP.status == 200)
      {
            alert(this.responseText);
      }
  }
  var queryString = "";
  for(var i = 0; i &lt; all_data.length; i++)
  {
      queryString += "data"+i.toString()+"=" + all_data[i];
      if(i &lt; all_data.length - 1)
      {
             queryString += "&amp;";
      }
  }
  xmlHTTP.open("POST", "www.example.com/process.php", true);
  xmlHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHTTP.send(queryString);
  </code></pre>
  
  <p>The PHP code below is just designed to echo out the POST data. As just a test, I wanted to see what the value of <code>data0</code> would be, but when I go to www.example.com/process.php, I get an error <code>Notice: Undefined index: data0 in /var/www/html/process.php on line 2</code>. However, when I navigate back to the page where the javascript is, it alerts the response with the correct data that was sent. Why doesn't the data be shown in the PHP file?</p>
  
  <pre><code>&lt;?php
          echo $_POST["data0"];
  ?&gt;
  </code></pre>