我尝试让这个登录页面运行。
我的问题是,我从来没有达到这条线:
header(“location:questions1.php”);
我很确定它是if()但是我尝试了很多东西而且没有任何工作 我的登录很好。我只是想检查一下邮件和邮件中有什么东西,而不是转到下一页。
if(isset($_POST['add']))
{
if(empty($_POST['position'])) {
echo '<script> alert("position is required!"); </script>';
}
else
{
$position = test_input($_POST["position"]);
$description = $_POST["description"];
$sql= "insert into tbl_jobdescription(position,description) values ('$position','$description')";
$result = mysqli_query($conn,$sql)or die(mysqli_error());
if($result) {
echo '<script> alert("Successfully add admin account."); </script>';
$position = $description = "";
}
}
}
标题行运行良好我将if设置为true但我需要检查邮件和pw是否设置为befor。
答案 0 :(得分:0)
尝试
已移除 ./
来自 ./connect.php
<?php
if (isset($_POST['login']) && !empty($_POST['mail']) && !empty($_POST['pw'])) {
include $_SERVER['DOCUMENT_ROOT'] . './connect.php';
$sql = "SELECT userdb.Email,userdb.Password FROM userdb";
$s = $pdo->prepare($sql);
$s->execute();
header("location: questions1.php");
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<title>Login</title>
</head>
<body>
<form action="" method="post">
<p>E-Mail:<input type="text" name="mail" required/></p>
<p>Password:<input type="password" name="pw" required/></p>
<button type="submit" name="login">Login</button>
</form>
</body>
</html>