Alright, I have been working at this for some time. Cannot seem to locate the issue. I have searched through Stackoverflow for similar issues but they all appear to point at the prepare statement for typos.
I haven't found any typos here but I am still getting the error
Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given
$sql = "INSERT INTO users (email, password, firstname, lastname, date, position, department, manager, birthdate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
if($stmt = mysqli_prepare($link, $sql)){
mysqli_stmt_bind_param($stmt, "sssssssss", $param_email, $param_password, $param_firstname, $param_lastname, $param_department, $param_position, $param_manager, $param_date, $param_birthdate);
$param_email = $email;
$param_password = password_hash($password, PASSWORD_DEFAULT);
$param_firstname = $firstname;
$param_lastname = $lastname;
$param_department = $department;
$param_position = $position;
$param_manager = $manager;
$param_date = $date;
$param_birthdate = $birthdate;
if(mysqli_stmt_execute($stmt)){
// Redirect to login page
header("location: index.php");
} else{
echo "Something went wrong. Please try again later.";
}
}
mysqli_stmt_close($stmt);