当用户点击提交按钮时,我想要没有页面重定向
在这里,我只发布了userid
。我也想发布password
。
这是我的HTML文本区域和按钮:
<input type="text" name="user" id="user" value="" placeholder="Mail-Id"><br>
<input type="text" name="userp" id="userp" value="" placeholder="Password"><br>
<input type="button" name="checkuser" id="checkuser" value="Validated" onclick="test();">
<script>
function test()
{
var username = document.getElementById('user').value;
var url = "login.php?user="+username;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var result = xmlhttp.responseText;
if(xmlhttp.responseText!='')
{
document.getElementById('use`enter code here`r_status').innerHTML =result ;
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
</script>
<?php
include_once('B810.php');
$Email = $_REQUEST['user'];
//$password = $_REQUEST['userp'];
$Q810_1 = "SELECT SIGNUP.EMAIL,SIGNUP.PWD FROM SIGNUP WHERE SIGNUP.EMAIL='".$Email."'";
// AND SIGNUP.PWD='".$password."' ";
$R810_1 = mysql_query($Q810_1);
$O810 = mysql_fetch_assoc($R810_1);
if (($O810)) {
echo 'success';
// header("Attendance.html");
// exit();
} else
echo 'failure';
}
//mysqli_close($con);
?>
答案 0 :(得分:0)
更改此代码
var username = document.getElementById('user').value;
var url = "login.php?user="+username;
要
var username = document.getElementById('user').value;
var password = document.getElementById('userp').value;
var url = "login.php?user="+username+'&password='+password;