0 && !empty($Unavailable_From) && !empty($Unavailable_To)) {
// Prepare and bind
$stmt = $mysqli->prepare("INSERT INTO Teacher_Unavailability (Teacher_ID, Unavailable_From, Unavailable_To) VALUES (?, ?, ?)");
if ($stmt) {
$stmt->bind_param("iss", $Teacher_ID, $Unavailable_From, $Unavailable_To);
if ($stmt->execute()) {
//echo "
Unavailable date added successfully.
";
header("Location: teacher_unavailability.php?error=Unavailable date added successfully.");
exit();
} else {
//echo "
Error: Could not insert record.
";
header("Location: teacher_unavailability.php?error=Could not insert record.");
exit();
}
$stmt->close();
} else {
//echo "
Error preparing statement.
";
header("Location: teacher_unavailability.php?error=Error preparing statement.");
exit();
}
} else {
//echo "
Please fill in all fields correctly.
";
header("Location: teacher_unavailability.php?error=Please fill in all fields correctly.");
exit();
}
}
?>