-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathDeleteDoctorFromClinic.php
133 lines (126 loc) · 5.09 KB
/
DeleteDoctorFromClinic.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<html>
<head>
<script src="jquerypart.js" type="text/javascript"></script>
<link rel="stylesheet" href="adminmain.css">
<script>
function getState(val)
{
$.ajax
({
type: "POST",
url: "getclinic.php",
data:'city='+val,
success: function(data)
{
$("#clinic-list").html(data);
}
});
}
function getDoctorday(val)
{
$.ajax
({
type: "POST",
url: "getdoctorday.php",
data:'cid='+val,
success: function(data)
{
$("#doctor-list").html(data);
}
});
}
</script>
</head>
<body style="background-image: url(Images/Pic10.jpg);">
<ul>
<li class="dropdown"><p style="font-family: cursive;font-size: 40px;color: white;">ADMIN MODE</p></li>
<br>
<h2>
<li class="dropdown">
<br><br>
<a class="dropbtn" style="font-family: cursive;">DOCTOR</a>
<div class="dropdown-content">
<a href="NewDoctor.php" style="font-family: cursive;">Add new Doctor</a>
<a href="DeleteDoctor.php" style="font-family: cursive;">Delete Doctor</a>
<a href="ShowDoctor.php" style="font-family: cursive;">Show all Doctors</a>
<a href="DoctorSchedule" style="font-family: cursive;">Doctor Schedules</a>
</div>
</li>
<li class="dropdown">
<br><br>
<a class="dropbtn" style="font-family: cursive;">CLINIC</a>
<div class="dropdown-content">
<a href="NewClinic.php" style="font-family: cursive;">Add new Clinic</a>
<a href="DeleteClinic.php" style="font-family: cursive;">Delete Clinic</a>
<a href="AddDoctorToClinic.php" style="font-family: cursive;">Assign Doctor to a Clinic</a>
<a href="DeleteDoctorFromClinic.php" style="font-family: cursive;">Delete Doctor from a Clinic</a>
<a href="ShowClinic.php" style="font-family: cursive;">Show the Clinics</a>
</div>
</li>
<li>
<br><br>
<form method="POST" action="AdminLogin.php">
<button type="submit" class="cancelbtn" name="logout" style="float: left;font-size: 20px;font-family: cursive;">LOGOUT</button>
</form>
</li>
</h2>
</ul>
<center><h1 style="font-family: cursive">REMOVE DOCTOR FROM A CLINIC</h1><hr>
<form method="post" action="">
<label style="font-size:20px" style="font-family: cursive">City:</label>
<select name="city" id="city-list" class="demoInputBox" onChange="getState(this.value);">
<option value="" style="font-family: cursive">Select City</option>
<?php
include 'DBconnect.php';
$sql1="SELECT distinct city FROM clinic";
$results=$conn->query($sql1);
while($rs=$results->fetch_assoc())
{
?>
<option value="<?php echo $rs["city"]; ?>"><?php echo $rs["city"]; ?></option>
<?php
}
?>
</select>
<label style="font-size:20px" style="font-family: cursive">Clinic:</label>
<select id="clinic-list" name="clinic" onchange="getDoctorday(this.value);" >
<option value="" style="font-family: cursive">Select Clinic</option>
</select>
<label style="font-size:20px" style="font-family: cursive">Doctor & Time:</label>
<select name="doctor" id="doctor-list" >
<option value="" style="font-family: cursive">Select Day & Time</option>
</select>
<button name="submit" type="submit">Submit</button>
</form>
<?php
session_start();
require_once("includes.html");
include 'DBconnect.php';
if(isset($_POST['submit']))
{
$cid=$_POST['clinic'];
$rest=$_POST['doctor'];
$sql = "DELETE FROM doctor_available WHERE CID= $cid AND DID= $rest";
if (mysqli_query($conn, $sql))
{
// echo "Record deleted successfully!!";
// header( "Refresh:2; url=DeleteDoctorFromClinic.php");
echo "<script>
swal({
title: 'Record deleted successfully!!',
text: '',
type: 'success'
},
function(){
window.location.href = 'DeleteDoctorFromClinic.php';
});
</script>";
}
else
{
echo "Error deleting record: " . mysqli_error($conn);
}
}
?>
</body>
</html>