-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcanclebook.php
More file actions
69 lines (58 loc) · 2.19 KB
/
canclebook.php
File metadata and controls
69 lines (58 loc) · 2.19 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
background: linear-gradient(to right,rgb(255, 255, 255),rgb(0, 0, 0),rgb(18, 18, 245));
color: white;
}
</style>
</head>
<body>
<div style='width: 400px; margin: 200px auto; padding: 20px; border-radius: 10px; background-color: rgb(0, 0, 0);
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2); font-family: Arial, sans-serif; text-align: center;'>
<h2 style='color:rgb(255, 255, 255); margin-bottom: 10px;'>💀 Booking Cancelation</h2>
<div style='border-top: 2px dashed #333; padding: 15px 0; margin: 10px 0;'>
<form method="POST">
<h1>Enter Your Booking Id:
<input type="number" name="id"><br>
<input type='submit' name="submit" value="CANCLE BOOKING" style='background-color: #dc3545; color: white; font-size: 16px;
font-weight: bold; padding: 10px 20px; border: none;
border-radius: 5px; cursor: pointer; transition: 0.3s;'>
</form>
</div>
</body>
</html>
<?php
if(isset($_POST["submit"])){$bid = $_POST["id"];
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "movie_booking";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if(!$conn){
die("Connection failed: " . mysqli_connect_error());
}
$check_query = "SELECT * FROM bookings WHERE bookingid = '$bid'";
$check_result = mysqli_query($conn, $check_query);
if(mysqli_num_rows($check_result) > 0){
$sql = "DELETE FROM bookings WHERE bookingid = '$bid'";
$result = mysqli_query($conn, $sql);
if($result){
echo "<script>alert('Booking canceled successfully!')
window.location.href = 'home.php';</script>";
} else {
echo "<script>alert('Error canceling booking.')</script>";
}
} else {
echo "<script>alert('Booking ID not found!')
window.location.href = 'home.php';
</script>
";
}
mysqli_close($conn);
}
?>