title: how to pass two values from ajax to php
body: <p>I am working on a form which shows the data when a user enters its code so far it was working fine with AJAX and PHP but now my need is to show the data when the user enters the code in the textbox as well selects a value from the combo box I am stuck here can anyone help me?</p>
  
  <p>Here is my ajax code:</p>
  
  <pre><code>&lt;script&gt;
          function getXMLHTTP() { //function to return the xml http object
                  var xmlhttp=false;  
                  try{
                      xmlhttp=new XMLHttpRequest();
                  }
                  catch(e)    {       
                      try{            
                          xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
                      }
                      catch(e){
                          try{
                              xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                          }
                          catch(e1){
                              xmlhttp=false;
                          }
                      }
                  }
  
                  return xmlhttp;
              }
  
  
              function showsub(strURL) {
                 // var strURL="subjsele.php?makhcode="+document.nigran.makhcode.value+"&amp;mon="+document.nigran.mon.value;
                   var u = document.getElementByID('makhcode').value;
                   var g = document.getElementByID('cmbmon').value;
                   var req = getXMLHTTP();
  
                  if (req) {
  
                      req.onreadystatechange = function() {
                          if (req.readyState == 4) {
                              // only if "OK"
                              if (req.status == 200) {                        
                                  document.getElementById('subcomp').innerHTML=req.responseText;                      
                              } else {
                                  alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                              }
                          }               
                      }           
                      req.open("GET","getuser.php?u="+u+"&amp;g="+g, true);
                      req.send(null);
                  }
  
              }
          &lt;/script&gt;
  </code></pre>
  
  <p>here is my html</p>
  
  <pre><code>            &lt;tr&gt;
                  &lt;td align="right" width="58px"&gt;&lt;label class="" for="element_1"&gt;&lt;font size="3px"&gt;&lt;b&gt;Code&lt;/b&gt;&lt;/font&gt;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;&lt;input id="makhcode" name="makhcode" onkeyup="showyear('makhsele.php?makh='+this.value)" onkeypress="showsub()" type="text" maxlength="6" size="6" value=""/&gt;&lt;/td&gt;&lt;td&gt;&lt;label class="description" align="right" for="element_1"&gt;Month&lt;/label&gt;&lt;/td&gt;&lt;td&gt;&lt;select id="cmbmon" name="cmbmon" class="" onchange="showsub()" style="font-size:14px;"&gt;
                                  &lt;option value=""&gt;0&lt;/option&gt;
                                  &lt;option value="1"&gt;1&lt;/option&gt;
                                  &lt;option value="2"&gt;2&lt;/option&gt;
                                  &lt;option value="3"&gt;3&lt;/option&gt;
                                  &lt;option value="4"&gt;4&lt;/option&gt;
                                  &lt;option value="5"&gt;5&lt;/option&gt;
                                  &lt;option value="6"&gt;6&lt;/option&gt;
                                  &lt;option value="7"&gt;7&lt;/option&gt;
                                  &lt;option value="8"&gt;8&lt;/option&gt;
                                  &lt;option value="9"&gt;9&lt;/option&gt;
                                  &lt;option value="10"&gt;10&lt;/option&gt;
                                  &lt;option value="11"&gt;11&lt;/option&gt;
                                  &lt;option value="12"&gt;12&lt;/option&gt;
  
                  &lt;/td&gt;
              &lt;/tr&gt;
  </code></pre>
  
  <p>here is my php</p>
  
  <pre><code>&lt;?php
  $makhcode=$_GET["makhcode"];
  
  $mon=$_GET["cmbmon"];
  
  $con = mysql_connect('localhost', 'cepheisys', 'rajF@1998');
  if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
  
  mysql_select_db("pts_root", $con);
  
  $subqry = mysql_query("SELECT * FROM subject WHERE compulsory='1'")or die(mysql_error());
  echo "&lt;table&gt;";
  while($fetch = mysql_fetch_array($subqry));
  {
     $sscode  = $fetch["code"];
     $csubqry = mysql_query("SELECT * FROM nigstat WHERE makhcode='".$makhcode."' AND subcode='".$sscode."'") or die(mysql_error());
     $mmonval =  $csubqry["mon1"];
  
      echo "&lt;tr&gt;";
      echo "&lt;td&gt;.$mmonval.&lt;/td&gt;&lt;td&gt;&lt;/td&gt;";
      echo "&lt;/tr&gt;";
      echo "&lt;tr&gt;";
      echo "&lt;td width='200px'&gt;&lt;font color='#FF0033'&gt;&lt;strong&gt;".$fetch[name]."&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;input name='s_".$fetch[code]."' type='text' size='1' maxlength='2' value='$mmonval'&gt;&lt;/td&gt;&lt;input type='hidden' name='$mmonval' size='3' maxlength='3'&gt;";
      echo "&lt;/tr&gt;";
  }
  
  mysql_close($con);
  ?&gt;
  </code></pre>
  
  <p>I am using a second script as well to show the data associated with the code and its function is showyear()</p>