-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCancelBooking.php
64 lines (59 loc) · 2.36 KB
/
CancelBooking.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
<html>
<head>
<link rel="stylesheet" href="main.css">
</head> <?php $conn = mysqli_connect('localhost','root','','appointment'); ?>
<body style="background-image: url(Images/Pic6.jpg);">
<div class="header">
<ul>
<li style="float: left; border-right: none;"><a href="Login.php" class="logo"><img src="Images/Pic9.png" width="70px" height="60px"> <strong> WeCare </strong> Online Apppointment System </a></li>
<li> <a href="Login.php">HOME</a></li>
</ul>
</div>
<form action="CancelBooking.php" method="POST">
<div class="sucontainer">
<label style="font-size: 30px">Select your Apppointment to Cancel:-</label><br>
<select name="Apppointment" id="Apppointment-list" class="demoInputBox" style="width: 100%;height: 50px; border-radius: 10px;">
<option value="">Select My Apppointment</option>
</div>
<?php
session_start();
$username=$_SESSION['username'];
$date= date('Y-m-d');
$sql1="SELECT * from booking 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 booking 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>
</html>