title: html form not posting from javascript and php
body: <p>I have a html form that posts the data to a php file for processing, on this form there is a dynamically produced combo box that is produced from a php file using javascript. The combo box displays and functions fine when the page is loaded but when the form is submitted the value from this box isn't posted.</p>
  
  <p>the JavaScript function is  </p>
  
  <pre><code>function showUser(str) {
      if (str == "") {
          document.getElementById("selSubCat").innerHTML = "";
          return;
       } else { 
           if (window.XMLHttpRequest) {
              // code for IE7+, Firefox, Chrome, Opera, Safari
              xmlhttp = new XMLHttpRequest();
           } else {
               // code for IE6, IE5
               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
           }
           xmlhttp.onreadystatechange = function() {
               if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
                   document.getElementById("selSubCat").innerHTML = xmlhttp.responseText;
                }
           }
           xmlhttp.open("GET","getSubCats.php?Cat="+str,true);
           xmlhttp.send();
      }
  }
  </code></pre>
  
  <p>The html is</p>
  
  <pre><code>    &lt;td &gt;Category:&lt;/td&gt;
        &lt;td &gt; 
          &lt;select name="Cats" onchange="showUser(this.value)" &gt;&lt;?    
  
          $qryCats="SELECT * FROM tblCategories";
          $resCats=mysql_query($qryCats,$dbMain);
          while($rowCats = mysql_fetch_array($resCats)){
          echo "&lt;option value='".$rowCats['Name']."'&gt;".$rowCats['Name']."&lt;/option&gt;";
          }
      ?&gt;
      &lt;/select&gt;
  
      &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td &gt;Sub Category:&lt;/td&gt;
  
      &lt;td  id="selSubCat"&gt; 
      &lt;/td&gt;
      &lt;/tr&gt;
  </code></pre>
  
  <p>And the php file:</p>
  
  <pre><code>    &lt;? 
      include("dbconfig.php");
     $cat=$_GET['Cat'];
  
      $qryCats="SELECT * FROM tblSubCats WHERE Parent='" .$cat. "'";
          $resCats=mysql_query($qryCats,$dbMain);
          if ($numrow=mysql_num_rows($resCats)&gt;0){
              echo "&lt;select name='subCats'&gt;";
          while($rowCats = mysql_fetch_array($resCats)){
          echo "&lt;option value='" .$rowCats['Name']. "'&gt;" .$rowCats['Name']. "&lt;/option&gt;";
          }
  
          echo "&lt;/select&gt;";
          }
          else{
              echo " There are no sub categories ";
          }
      ?&gt;
  </code></pre>
  
  <p>Any suggestions will be appreciated, I can't figure out why everything else apart from the subcategory is posted</p>