Viewing file: edit-schedule.php (6.57 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include('conn.php');
require_once "auth.php";
// Retrieve the schedule ID from the query parameter
if (isset($_GET['id'])) {
$scheduleId = $_GET['id'];
// Fetch the schedule details from the database based on the ID
$query = "SELECT * FROM schedule WHERE id = $scheduleId";
$result = mysqli_query($con, $query);
$schedule = mysqli_fetch_assoc($result);
}
if (isset($_GET['delete_id'])) {
$delete_id = $_GET['delete_id'];
// Fetch the schedule details from the database based on the ID
$query1 = "DELETE FROM schedule WHERE id = $delete_id";
$result1 = mysqli_query($con, $query1);
if($result1){
echo '<script>alert("Deleted Successfully");</script>';
echo '<script>window.location.href = "add-schedule.php";</script>';
}else{
echo '<script>alert("Failed To Delete");</script>';
echo '<script>window.location.href = "add-schedule.php";</script>';
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php include('title.php') ?></title>
<link rel="shortcut icon" type="image/png" href="images/fav.png">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/themify-icons.css">
<!-- Animations CSS -->
<link rel="stylesheet" href="css/animate.css">
<!-- Main CSS -->
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/red.css" id="style_theme">
<link rel="stylesheet" href="css/responsive.css">
<!-- morris charts -->
<link rel="stylesheet" href="charts/css/morris.css">
<!-- jvectormap -->
<link rel="stylesheet" href="css/jquery-jvectormap.css">
<link rel="stylesheet" href="datatable/dataTables.bootstrap4.min.css">
<link href="../assets/Content/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../assets/Content/bootstrap-theme.min.css" />
<link rel="stylesheet" href="../assets/Content/MdBootstrapPersianDateTimePicker/jquery.Bootstrap-PersianDateTimePicker.css" />
<script src="../assets/Scripts/jquery-2.1.4.js" type="text/javascript"></script>
<script src="../assets/Scripts/bootstrap.min.js" type="text/javascript"></script>
<style type="text/css">
body, table {
font-family: 'Segoe UI', Tahoma;
font-size: 14px;
}
</style>
<!-- Include necessary CSS and JS files -->
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
form {
max-width: 400px;
margin: 0 auto;
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin-bottom: 10px;
font-weight: bold;
}
input[type="text"],
input[type="date"],
select {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
select {
height: 40px;
}
input[type="submit"] {
background-color: #4CAF50;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
</style>
<script src="js/modernizr.min.js"></script>
</head>
<body>
<!-- HTML code for the edit schedule form -->
<form action="update-schedule.php" method="POST">
<input type="hidden" name="id" value="<?php echo $schedule['id']; ?>">
<!-- Display the existing schedule details in the form fields -->
<label for="d_name">Doctor Name:</label>
<input type="text" id="d_name" name="d_name" value="<?php echo $schedule['d_name']; ?>" required>
<label for="start_date">Start Date:</label>
<input type="date" id="start_date" name="start_date" value="<?php echo $schedule['date_start']; ?>" required>
<label for="end_date">End Date:</label>
<input type="date" id="end_date" name="end_date" value="<?php echo $schedule['date_end']; ?>" required>
<label for="start_date_fa">تاریخ شروع</label>
<input type="text" name="date_start_fa" value="<?php echo $schedule['date_start_fa']; ?>" class="form-control" id="exampleInput3" placeholder="تاریخ" data-mddatetimepicker="true" data-placement="right" data-englishnumber="true" />
<label for="end_date_fa">تاریخ ختم</label>
<input type="text" name="end_date_fa" value="<?php echo $schedule['date_end_fa']; ?>" class="form-control" id="exampleInput3" placeholder="تاریخ" data-mddatetimepicker="true" data-placement="right" data-englishnumber="true" />
<label for="status">Status:</label>
<select id="status" name="status" required>
<option value="available" <?php if ($schedule['status'] == 'available') echo 'selected'; ?>>Available</option>
<option value="not-available" <?php if ($schedule['status'] == 'not-available') echo 'selected'; ?>>Not Available</option>
</select>
<input type="submit" name="update" value="Update">
</form>
<!-- Include necessary JS files -->
<script type="text/javascript">
$('#input1').change(function() {
var $this = $(this),
value = $this.val();
alert(value);
});
$('#textbox1').change(function () {
var $this = $(this),
value = $this.val();
alert(value);
});
</script>
<script src="../assets/Scripts/MdBootstrapPersianDateTimePicker/calendar.js" type="text/javascript"></script>
<script src="../assets/Scripts/MdBootstrapPersianDateTimePicker/jquery.Bootstrap-PersianDateTimePicker.js" type="text/javascript"></script>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="datatable/jquery.dataTables.min.js"></script>
<script src="datatable/dataTables.bootstrap4.min.js"></script>
<script src="js/custom.js"></script>
<script>
$(document).ready(function() {
$(".add-schedule-button").click(function() {
$(".add-schedule-form").toggle();
});
});
</script>
</body>
</html>
|