<>光>:
<form style="margin:5px 0;" action="#" method="post">
Buyer <input type="radio" name="addType" value="Buyer" />
Merchant <input type="radio" name="addType" value="Merchant" />
</form>
<form id="NewBuyerRegHp" method="post" action="check.php">
Username or Email: <input type="text" name="userOrEmail" class="UserLogin" value="Username" onFocus="clearText(this)" /> <br />
Password: <input type="password" name="userPass" class="UserLogin" value="Password" onFocus="clearText(this)" /> <br />
<input type="submit" name="SubmitNewBuyerHp" value="Secure Login" />
</form>
PHP
$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
}
When radio button: value="Buyer"
is chosen, it should run query $NewBuyerLoginCheck
如果选择了无线电台: Value=“Merchant”
,它就应当运行查询。 新Merch CarloinCheck
How do I do this based on the radio button selected upon submit using Ajax?