-
Notifications
You must be signed in to change notification settings - Fork 0
/
cancelbookingpatient.php
67 lines (62 loc) · 2.32 KB
/
cancelbookingpatient.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
<html>
<head>
<link rel="stylesheet" href="main.css">
<script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
</head><?php include "dbconfig.php"; ?>
<body style="background-image:url(images/cancelback.jpg)">
<div class="header">
<ul>
<li style="float:left;border-right:none"><a href="ulogin.php" class="logo"><img src="images/cal.png" width="30px" height="30px"><strong> Skylabs </strong>Appointment Booking System</a></li>
<li><a href="ulogin.php">Home</a></li>
</ul>
</div>
<form action="cancelbookingpatient.php" method="post">
<div class="sucontainer">
<label style="font-size:20px" >Select Appointment to Cancel:</label><br>
<select name="appointment" id="appointment-list" class="demoInputBox" style="width:100%;height:35px;border-radius:9px">
<option value="">Select Appointment</option>
<?php
session_start();
$username=$_SESSION['username'];
$date= date('Y-m-d');
$sql1="SELECT * from book where username='".$username."'and status not like 'Cancelled by Patient' and DOV >='$date'";
$results=$conn->query($sql1);
while($rs=$results->fetch_assoc()) {
$sql2="select * from doctor where did=".$rs["DID"];
$results2=$conn->query($sql2);
while($rs2=$results2->fetch_assoc()) {
$sql3="select * from clinic where cid=".$rs["CID"];
$results3=$conn->query($sql3);
while($rs3=$results3->fetch_assoc()) {
?>
<option value="<?php echo $rs["Timestamp"]; ?>"><?php echo "Patient: ".$rs["Fname"]." Date: ".$rs["DOV"]." -Dr.".$rs2["name"]." -Clinic: ".$rs3["name"]." -Town: ".$rs3["town"]." - Booked on:".$rs["Timestamp"]; ?></option>
<?php
}
}
}
?>
</select>
<button type="submit" style="position:center" name="submit" value="Submit">Submit</button>
</form>
<?php
if(isset($_POST['submit']))
{
$username=$_SESSION['username'];
$timestamp=$_POST['appointment'];
$updatequery="update book set Status='Cancelled by Patient' where username='$username' and timestamp= '$timestamp'";
if (mysqli_query($conn, $updatequery))
{
echo "Appointment Cancelled successfully..!!<br>";
header( "Refresh:2; url=ulogin.php");
}
else
{
echo "Error: " . $updatequery . "<br>" . mysqli_error($conn);
}
}
?>
</body>
<footer>
<h4 align="center">© Copyright 2018, Muhammad Bilal Sadiq<h4>
</footer>
</html>