I am creating a login page in php. I want to redirect user to auto page after they succesfully login. Since I am using pdo, I am using require\_once to call pdo.php. However, this line of code prevent to to redirect the designated page. If I remove the require\_once code, i can successfully back to index page after I hit cancle. The following code will take me to auto.php page

```
<?php

require_once "pdo.php";
require_once "bootstrap.php"; 

if ( isset($_POST['cancel'] ) ) {
    // Redirect the browser to game.php
    header("Location: index.php");
    return;
}

$failure = false; 

if ( isset($_POST['email']) && isset($_POST['password'])  )   {

      if ( strlen($_POST['email']) < 1 || strlen($_POST['password']) < 1 ) {
        $failure = "User name and password are required";
      }

    else if (strpos($_POST['email'], '@')!== false)
    {

      $e = htmlentities($_POST['email']);
      $p = htmlentities($_POST['password']);

      $sql = "SELECT email FROM users
         WHERE email = '$e'
         AND password = '$p'";

      echo "<p>$sql</p>\n";

      $stmt = $pdo->query($sql);
      $row = $stmt->fetch(PDO::FETCH_ASSOC);

      var_dump($row);
      echo "-->\n";
      if ( $row === FALSE ) {
         echo "Incorrect password";
      } 
      else {
        header("Location: autos.php?name=".urlencode($_POST['email']));
        return;
      }
    }
    else
        {
          $failure = "Email must have an at-sign (@)";
        }

}
?>

```