-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage.php
104 lines (77 loc) · 2.69 KB
/
manage.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
<?php
include_once 'import/header.php';
?>
<?php
include_once 'import/heading.php';
?>
<?php
include_once 'import/select.php';
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/manage.css"> <!-- Link to the external CSS file -->
</head>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "flymaster_login";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if (isset($_POST['booking_id'])) {
$booking_id = $_POST['booking_id'];
$stmt = $conn->prepare("SELECT * FROM booking WHERE booking_ID = ?");
$stmt->bind_param("s", $booking_id);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
echo '<div class="shadow-box">';
while ($row = $result->fetch_assoc()) {
echo'<p class="qresult">';
echo "Booking ID : " . $row["booking_ID"] . "<br>";
echo "Customer Name : " . $row["name"] . "<br>";
echo "Airline: " . $row["airline"] . "<br>";
echo "Seat Number : " . $row["seat_number"] . "<br>";
echo "From : " . $row["from"] . "<br>";
echo "TO : " . $row["to"] . "<br>";
echo "Meal Preference : " . $row["meal"] . "<br>";
echo'</p>';
echo '<form method="post" action="includes/del.manage.inc.php">';
echo '<input type="hidden" name="booking_id" value="' . $booking_id . '">';
echo '<button class="delete-button" type="submit" name="delete">Delete</button>';
echo '</form>';
echo '<button class="update-button" name="meal" onclick="changeMeal()">Change Meal</button>';
}
echo '</div>';
} else {
echo'<div class="box" >';
echo "<h2 class='errmsg'>⛔ No booking found with the given ID. ⛔</h2>";
echo'</div>';
}
$stmt->close();
}
$conn->close();
?>
</body>
</html>
<div class="form">
<h1 class="mbheading">Manage Booking</h1>
<form action="" method="post">
<label class="label1" for="booking_id">Booking ID:</label>
<input type="text" id="booking_id" name="booking_id" required placeholder="1020">
<button class="login-button" name="submit" type="submit">View Booking</button>
</form>
<p>© 2023 FLY MASTER</p>
</div>
<script>
function changeMeal(){
window.location.href = 'includes/meal.php';
}
</script>
<?php
include_once 'import/footer.php';
?>