title: PHP - script not being executed
body: <p>I have a html form which the user inputs values/selects options. After selecting, these values would be sent to the php script in the server. The script would be retrieving some data from mysql depending on the values the user selected. These values and data from mysql would then be collated together and used in a <code>POST</code> request which would be sent to a mobile device. I would be using curl to do the request.</p>
  
  <p>However, I'm unable to do any <code>POST</code> request. I'm not seeing any results or changes. I tried doing <code>echo</code> in my php script but it's not printing out on the html form even if I used <code>GET</code></p>
  
  <p>Where did I go wrong in my code?</p>
  
  <p><strong>.html</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      function doSubmit() {
  
          var env = document.frm.Env.value;
          var appname = document.frm.appname.value;
          var target = document.frm.target.value;
          var messages = document.frm.messages.value;
  
          var strURL = "sendMessage.php?Env=" +env+ "&amp;appname=" +appname+ "&amp;target=" +target+ "&amp;Message=" +messages;
  
          xmlhttp.open("GET",strURL,true);
          xmlhttp.send(null);
  
      }
  &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;form action=""&gt;
          Environment: &lt;div id="Env"&gt;
              &lt;select name="customers" onchange="showApplications(this.value)"&gt;
                  &lt;option value="Environment"&gt;Select an environment&lt;/option&gt;
                  &lt;option value="S"&gt;Sandbox&lt;/option&gt;
                  &lt;option value="P"&gt;Production&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
  
          &lt;/br&gt;
  
          Application Name: &lt;div id="appname"&gt;
              &lt;select name="appname" onchange="showTargets(this.value)"&gt;
                  &lt;option value=""&gt;Select application&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
  
          &lt;/br&gt;
  
          Target Device : &lt;div id="target"&gt;
              &lt;select name="target"&gt;
                  &lt;option&gt;Select Device OS&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
          &lt;/br&gt;
          Message: &lt;div id="messages"&gt;&lt;input type="text" name="Message" maxlength="200" size="50"&gt;&lt;/input&gt;&lt;/div&gt;
  
          &lt;/br&gt;
  
          &lt;input type = "button" value="Send" onclick="doSubmit();"&gt;
      &lt;/form&gt;
  
      &lt;/br&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>.php</strong></p>
  
  <pre><code>&lt;?php
  $env      = mysql_real_escape_string($_POST["env"]);
  $appname  = mysql_real_escape_string($_POST["appname"]);
  $target   = mysql_real_escape_string($_POST["target"]);
  $messages = mysql_real_escape_string($_POST["messages"]);
  
  
  $conn = mysql_connect("127.0.0.1:3306", "root", "");
  mysql_select_db("PushApplication", $conn);
  
  if ($target == "All") {
      echo "Hi";
  } elseif ($target == "Apple") {
      echo "Apple";
      $query  = "select deviceID from Device where DeviceType='$target'";
      $result = mysql_query($query);
  
      $num = mysql_numrows($result);
  
      $i = 0;
      while ($i &lt; $num) {
          $myResult = mysql_result($result, $i);
          $url      = "http://10.28.68.28:8899/?Env='$env'&amp;AppName='$target'&amp;Token='$myResult'&amp;Message=%7B%22aps%22%3A%7B%22alert%22%3A%22'$messages'%22%7D";
          echo $url;
          curl $url
          ++$i;
      }
  }
  
  else
      echo "Hi!";
  ?&gt;
  
  &lt;/select&gt;
  </code></pre>