我试图为我的网站建立一个注册系统,我制作了代码,但是当我运行网站并注册时,我得到一个白色的屏幕。 PHP和SQL代码:
$db = mysqli_connect("localhost", "root","", "users") or die(mysql_error());
if (isset($_POST['Register_btm'])){
$name = $_POST['name'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
if ($password == $password2) {
$password = MD5($password);
}else{
echo("הסיסמאות שהזנת לא תואמות");
}
if(isset($_POST["Register_btm"])) {
//echo($name);
//echo($email);
//echo($username);
//echo($password);
//echo($password2);
$sql = "INSERT INTO users(`id`, `Date`, `name`, `email`, `username`, `password`)
VALUES ('', '' ,'".$name."','".$email."','".$username."','".$password."')" or die(mysql_error());
mysqli_query($db, $sql) or die(mysql_error());
echo("נרשמת בהצלחה");
}
}
?>
HTML code:
<!DOCTYPE html>
<html lang="he">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form method="post" action="/Test/php/Register.php">
Name: <input type="text" name="name">
E-mail: <input type="text" name="email">
username: <input type="text" name="username">
password: <input type="password" name="password">
password agin: <input type="password" name="password2">
<input type="submit" name="Register_btm" value = "שלח"> or<a href="#">Login</a>
</form>
</body>
</html>
我多次检查了连接细节,它们是正确的。我运行网站没有错误。我输入密码和第二个密码不兼容我收到一条错误消息,但我输入了密码和密码验证,所以我得到一个白色的屏幕,没有错误。 The white screen appearance