-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAddDoctorToClinic.php
144 lines (136 loc) · 5.94 KB
/
AddDoctorToClinic.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
134
135
136
137
138
139
140
141
142
143
144
<?php session_start(); ?>
<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 getDoctorRegion(val)
{
$.ajax
({
type: "POST",
url: "getdoctorregion.php",
data:'city='+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="DoctorSchedule.php" style="font-family: cursive;">Doctor Schedules</a>
<a href="ShowDoctor.php" style="font-family: cursive;">Show all Doctors</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>ASSIGN DOCTOR TO A CLINIC</h1><hr>
<form method="post" action="AddDoctorToClinic.php">
<label style="font-size:20px; font-family:cursive" >City:</label>
<select name="city" id="city-list" class="demoInputBox" onChange="getState(this.value);getDoctorRegion(this.value);">
<option value="">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 ;font-family:cursive">Clinic:</label>
<select id="clinic-list" name="cid">
<option value="">Select Clinic</option>
</select>
<label style="font-size:20px;font-family:cursive" >Doctor:</label>
<select name="doctor" id="doctor-list">
<option value="">Select Doctor</option>
</select>
<label style="font-size:20px ;style=font-family:cursive">
<p style="font-family:cursive">Available Days<br>
<table>
<tr><td style="font-family:cursive">Monday:</td><td><input type="checkbox" value="Monday" name="daylist[]"/></td></tr>
<tr><td style="font-family:cursive">Tuesday:</td><td><input type="checkbox" value="Tuesday" name="daylist[]"/></td></tr>
<tr><td style="font-family:cursive">Wednesday:</td><td><input type="checkbox" value="Wednesday" name="daylist[]"/></td></tr>
<tr><td style="font-family:cursive">Thursday:</td><td><input type="checkbox" value="Thursday" name="daylist[]"/></td></tr>
<tr><td style="font-family:cursive">Friday:</td><td><input type="checkbox" value="Friday" name="daylist[]"/></td></tr>
<tr><td style="font-family:cursive">Saturday:</td><td><input type="checkbox" value="Saturday" name="daylist[]"/></td></tr>
</table>
<p style="font-family:cursive">Availability(24 hour Format):<br>
From:<input type="time" name="starttime"><br>
To:<input type="time" name="endtime">
</label>
<button name="submit" type="submit" style="font-family:cursive">SUBMIT</button>
</form>
<center>
<?php
if(isset($_POST['submit']))
{
include 'DBconnect.php';
$cid=$_POST['cid'];
$did=$_POST['doctor'];
$starttime=$_POST['starttime'];
$endtime=$_POST['endtime'];
foreach($_POST['daylist'] as $daylist)
{
$sql = "INSERT INTO doctor_available(CID, DID,day,starttime,endtime) VALUES ('$cid','$did','$daylist','$starttime','$endtime')";
if (mysqli_query($conn, $sql))
{
echo "<h2>Record created successfully( CID=$cid DID=$did Day=$daylist )!!</h2>";
header("Refresh:3;url=AddDoctorToClinic.php");
}
else
{
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
}
}
?>
</form>
</body>
</html>