Skip to content

Instantly share code, notes, and snippets.

@lenconda
Created July 6, 2017 07:03
Show Gist options
  • Save lenconda/56eed119b45dc877de2b7287c09b578b to your computer and use it in GitHub Desktop.
Save lenconda/56eed119b45dc877de2b7287c09b578b to your computer and use it in GitHub Desktop.
这是添加用户的判断语句
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