Viewing file: update-schedule.php (988 B) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include('conn.php');
require_once "auth.php";
// Check if the form is submitted
if (isset($_POST['update'])) {
$scheduleId = $_POST['id'];
$d_name = $_POST['d_name'];
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];
$start_date_fa = $_POST['date_start_fa'];
$end_date_fa = $_POST['end_date_fa'];
$status = $_POST['status'];
// Update the schedule in the database based on the ID
$query = "UPDATE schedule SET d_name='$d_name', date_start='$start_date', date_end='$end_date', date_start_fa='$start_date_fa', date_end_fa='$end_date_fa', status='$status' WHERE id=$scheduleId";
$result = mysqli_query($con, $query);
if ($result) {
echo "<script>alert('Schedule updated successfully');</script>";
echo '<script>window.location.href = "add-schedule.php";</script>';
exit();
} else {
echo "<script>alert('Failed to update schedule');</script>";
}
}
?>
|