-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatient_booking.php
More file actions
135 lines (118 loc) · 2.99 KB
/
patient_booking.php
File metadata and controls
135 lines (118 loc) · 2.99 KB
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
<?php
session_start();
if(time()-$_SESSION["tim"]>60){
echo "<script>alert('Session timed out');";
echo "window.location.href='logout.php';</script>";
}
else{
$_SESSION["tim"]=time();
}
if(isset($_POST['id'])){
$conn=mysqli_connect("localhost","root","","testdb");
if(!$conn){
die("failed");
}
$h=mysqli_query($conn,"Insert into booked values(".$_SESSION['id'].",".$_POST['id'].");");
}
?>
<html>
<head>
<style>
body{
margin:0;
background-color: #c0c0c0;
}
.navigation{
width:15%;
height:100%;
position:fixed;
background-color:lightblue;
margin: 0;
}
.navigation button{
width:100%;
border:none;
display:inline-block;
padding:15px;
background-color:lightblue;
font-size: 20px;
font-weight: bolder;
}
.navigation button:hover{
background-color:black;
color:white;
}
.top{
margin-left:15%;
}
.round{
width:200px;
height:200px;
border-radius: 50%;
background-color: red;
background-image: url('doctor.jpg');
}
.big{
margin-left:18%;
}
table{
width:100%;
}
</style>
</head>
<body>
<div class="navigation">
<div class="round">
</div>
<a href="patient_dash.php"><button>Overview</button></a>
<a href="patient_booking.php"><button style="background-color:black;color:white;">Book ticket</button></a>
<a href="patient_report.php"><button>Check Report</button></a>
<a href="patient_notice.php"><button>Check Notice</button></a>
<a href="patient_news.php"><button>News</button></a>
<a href="logout.php"><button>Sign Out</button></a>
</div>
<div class="top"><center><h2>
<?php
if($_SESSION["Name"]){
echo "Welcore on board ".$_SESSION["Name"]."!!";
}
else{
echo "Welcome";
}
?>
</h2></center><hr></div>
<div class="big">
<?php
$conn=mysqli_connect("localhost","root","","testdb");
if(!$conn){
die("failed");
}
$h=mysqli_query($conn,"Select * from booked where patient_id= ".$_SESSION['id']." ;");
$r=mysqli_num_rows($h);
if($r>0){
echo "You already have a booking";
$row=mysqli_fetch_assoc($h);
$h=mysqli_query($conn,"Select * from doctor where ID=".$row['doc_id'].";");
$row=mysqli_fetch_assoc($h);
echo "Doctor name: ".$row['Name'];
}
else{
$h=mysqli_query($conn,"Select * from doctor;");
$r=mysqli_num_rows($h);
if($r>0){
echo "<table><tr><td colspan=5 style='background-color:powderblue;'><center><h4>Doctors</h4></center></td></tr>";
echo "<tr><td>ID</td><td>Doctor name</td><td>Department</td><td>Mobile</td><td>Action</td></tr>";
while($row=mysqli_fetch_assoc($h)){
echo "<tr><td>" . $row["ID"]. "</td>";
echo "<td>" . $row["Name"]. "</td>";
echo "<td> " . $row["Department"]. "</td>";
echo "<td>".$row["phone"]."</td>";
echo "<td><form action='patient_booking.php' method='POST'><input type='hidden' name='id' value=".$row["ID"].">";
echo "<input type='submit' value='Book'></form></td>";
echo "</tr>";
}
}
echo "</table>";
}
?>
</div>