所以我有一个网站,我正在尝试测试新的用户注册功能。我没有得到我的LogInHelper.php文件中任何回声的输出。目标是能够为新用户输入信息,将其发布到LogInHelper.php,查看输入的密码是否相等,如果不相同,则将结果div更新为错误消息。
这是我的包含html的LogIn.php文件:
<?php
$servername = "localhost";
$username = "user";
$password = "pass";
$database = "db";
$con = mysqli_connect($servername,$username,$password,$database);
if($con->connect_error){
die("Connection failed " . $con->connect_error);
}
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$id = $_POST['department'];
$email = $_POST['email'];
$pass = md5($_POST['pass']);
$pass2 = md5($_POST['pass2']);
echo $firstname;
echo $lastname;
echo $id;
echo $email;
echo $pass;
echo $pass2;
$sel = "select * from Employee where email='$email'";
$run = mysqli_query($con,$sel);
$check_email = mysqli_num_rows($run);
if(!($pass==$pass2)){
echo "<h2>Your emails do not match, please try again!</h2>";
exit();
}
else if($check_email==1){
echo "<h2>This email is already registered, please try another!</h2>";
exit();
}
else{
$insert = "insert into Employee (email, first, last, department_id,pass,) values ('$email','$firstname','$lastname','$id', '$pass')";
$run_insert = mysqli_query($con,$insert);
if($run_insert){
echo "<h2>Registration Successful, Thanks!</h2>";
}
}
mysqli_close($con);
?>
这是我收到帖子的LogInHelper文件:
binaryTree.addNodeRecursion(new MNode(50, "fourth"))
binaryTree.addNodeRecursion(new MNode(25, "third"))
binaryTree.addNodeRecursion(new MNode(15, "second"))
binaryTree.addNodeRecursion(new MNode(10, "first"))
binaryTree.addNodeRecursion(new MNode(75, "fifth"))
binaryTree.addNodeRecursion(new MNode(85, "sixth"))
答案 0 :(得分:1)
我检查了您的$("#sub").click(function(){
,发现您在var fist_name = $("#firstname").val();
中出现拼写错误错误,因此应该var first_name = $("#firstname").val();
请在此之后更新此内容