0


I try to get this login page running.
My problem is that i never reach the line:

header("location: questions1.php");

Im pretty sure its the if() but i tried many things and nothing is working.
My loggin is fine. I just wanna check that there is somthing in mail and pw and than go to the next page.

<!DOCTYPE html>
<html lang="de">
<head>
    <title>Login</title>
</head>
<body>
<div content="php">
    <?php
    if (isset($_POST['login']) && !empty($_POST['mail']) && !empty($_POST['pw'])) {
        header("location: questions1.php");
    }
    ?>
</div>
<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>

The header line works well i set the if to true but i need to check if mail and pw are set befor.

The8Monkey
  • 15
  • 5

1 Answers1

0

Try
Removed ./ From ./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>