title: Ajax Run Given Query Upon Submit Based on Radio Button Chosen
body: <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;form style="margin:5px 0;" action="#" method="post"&gt; 
              Buyer &lt;input type="radio" name="addType" value="Buyer" /&gt;
              &amp;nbsp;&amp;nbsp;Merchant &lt;input type="radio" name="addType" value="Merchant" /&gt;
          &lt;/form&gt;
          &lt;form id="NewBuyerRegHp" method="post" action="check.php"&gt;
              Username or Email: &lt;input type="text" name="userOrEmail" class="UserLogin" value="Username" onFocus="clearText(this)" /&gt; &lt;br /&gt;
              Password: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type="password" name="userPass" class="UserLogin" value="Password" onFocus="clearText(this)"  /&gt; &lt;br /&gt;
              &lt;input type="submit" name="SubmitNewBuyerHp" value="Secure Login" /&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p><strong>PHP</strong> 
     
  
  <pre><code>$NewBuyerLoginCheck = mysql_query("SELECT uUName, uEmail, uUPass, dynamSalt FROM User WHERE uUName OR uEmail = '".mysql_real_escape_string($_POST['userOrEmail'])."' AND uUPass = sha2(concat(dynamSalt, '".mysql_real_escape_string($_POST['userPass'])."'), 512) ")or die(mysql_error());
  
  $NewMerchLoginCheck = mysql_query("SELECT mUsername, mEmail, mUPass, mdynamSalt FROM Merchant WHERE mUsername OR mEmail = '".mysql_real_escape_string($_POST['userOrEmail'])."' AND mUPass = sha2(concat(dynamSalt, '".mysql_real_escape_string($_POST['userPass'])."'), 512) ")or die(mysql_error());
  
  
  if(mysql_num_rows == 1){
  echo "Success"; 
  //then redirect the users homepage
  }
  else(mysql_num_rows == 0){
  echo "Error"; 
  // then redirect to original login form, for relogin
  }
  </code></pre>
  
  <p>When radio button: <code>value="Buyer"</code> is chosen, it should run query <code>$NewBuyerLoginCheck</code></p>
  
  <p>When radio button: <code>value="Merchant"</code> is chosen, it should run query <code>$NewMerchLoginCheck</code></p>
  
  <p>How do I do this based on the radio button selected upon submit using Ajax?</p>