Created
July 6, 2017 07:03
-
-
Save lenconda/56eed119b45dc877de2b7287c09b578b to your computer and use it in GitHub Desktop.
这是添加用户的判断语句
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isset($_POST['submit'])){ | |
if ($_POST['name'] == '') { | |
echo "<script>alert('非法输入!')</script>"; | |
}elseif ($_POST['pw'] == '') { | |
echo "<script>alert('非法输入!')</script>"; | |
}elseif ($_POST['repw'] == '') { | |
echo "<script>alert('非法输入!')</script>"; | |
}elseif ($_POST['pw'] == $_POST['repw']) { | |
$query = "insert into user (name,pw,role) values('{$_POST['name']}','{$_POST['pw']}','{$_POST['role']}')"; | |
$result=mysqli_query($link, $query); | |
echo "<script>alert('添加新用户成功!')</script>"; | |
}else{ | |
echo "<script>alert('用户名与密码不一致!')</script>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment