When I print the print_r($SESSION) function it shows up empty. Here is the code below (ps. dont worry about SQL injection at the moment).
Everything else works PERFECTLY, errors show up perfectly. Its just the session values come up empty!
<?php
session_start();
include 'dbconnect.php';
$emailerror = $passworderror = "";
if(isset($_POST['submit']))
{
$email= $_POST["email"];
$password= $_POST["password"];
if (empty($email)) {
$emailerror = "*Email must be entered";
}
elseif (!filter_var($email, FILTER_VALIDATE_EMAIL))
{
$emailerror= "*Invalid email address Entered";
}
// To check if email has already been used or if another account with the same email exists
else{
$emailquery = ("SELECT * FROM `Potential_Employee` WHERE `Email` = '$email'");
$emailcheckresult = mysqli_query($connection, $emailquery);
if(mysqli_num_rows($emailcheckresult) == 1){
$row=mysqli_fetch_assoc($emailcheckresult);
if (!password_verify($password, $row['Password'])){
$passworderror = "*Password is incorrect!";
}
else{
$_SESSION['Email'] = $email;
$_SESSION['logged_in'] = true;
echo "<script>document.location='EmployeeDashboard.php';</script>";
}
}
else{
$emailerror = "*Email does not exist";
}
}
if (empty($password)) {
$passworderror = "*Password must be entered";
}
elseif (strlen($password) < 4 )
{
$passworderror= "*Password Has to be greater than 8 Characters";
}