<?php
include 'db.php';
session_start();
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
if (isset($_POST['email'])) {
$loginEmail = $_POST['email'];
}
$sql = "SELECT UserEmail FROM User WHERE UserEmail = '$loginEmail' ";
$result = mysqli_query($conn, $sql);
$count = mysqli_num_rows($result);
if ($count == 1) {
// User doesn't exist
header("location: home.html");
}
{ // User exists
header("location: index.php");
}
}
mysqli_close($conn);
?>
Code either takes me to index page or home page, but does not check to see if email is in MySQL database. It is either not recognizing the email in the database or something else is going on.