I have a login page which redirects users based on registration status. It worked at first but now not redirect again.
This is my php code;
if($_SERVER["REQUEST_METHOD"] == "POST"){
$stmt = $conn->prepare("SELECT application_no, password, reg_status FROM
students_registration WHERE email = ? ");
$stmt->bind_param("s", $email);
$stmt->execute();
$stmt->bind_result($application_no, $hashedpassword, $reg_status);
$stmt->store_result();
if($stmt->num_rows > 0){
$stmt->fetch();
if(password_verify($password, $hashedpassword)){
if($reg_status = 1){
header("location:homeapplicant.php");
}else{
header("location: admissionform.php");
$_SESSION["loggedin"] = true;
$_SESSION["application_no"] = $application_no;
$_SESSION["email"] = $email;
$_SESSION["reg_status"] = $reg_status;
exit();
//echo "congratulations";
//echo "<script type=text/javascript>window.location.href = 'biodata.php';</script>";
}
}
else{
$password_err = "The password you entered was not valid.";
}
}
else{
$email_err = "No account found with that email.";
}
$stmt->close();
}
}else{
}$conn->close();
It worked without checking for reg_status but with reg_status it did not redirect to any page, it just reload login page.
Please where did I get it wrong? I need your help