-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin_deletedetail.php
125 lines (117 loc) · 3.9 KB
/
admin_deletedetail.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
session_start();
if(session_id()=='' || isset($_SESSION['user'])){
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "1234";
$dbname = "coffeecorner";
$connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
$user = $_SESSION['user'];
if(isset($_GET['save']))
{
$id = mysqli_real_escape_string($connection, $_GET['aa']);
$sql1 = "DELETE FROM `add_reservation` WHERE `reserve_id` = '$id'";
$result1 = mysqli_query($connection, $sql1);
if(!$result1)
{
die("database query fail!" . mysqli_error($connection) . mysqli_errno($connection));
}
header("location: admin_view.php");
}else if(isset($_GET['save1']))
{
header("location: admin_view.php");
}
?>
<!doctype html>
<html>
<head>
<link href="admin_deletedetail.css?v=random number/string" rel="stylesheet" type="text/css">
<meta charset="utf-8">
<title>Admin | Delete</title>
</head>
<body class="ggwp">
<h2 class="h2">Coffee Corner</h2>
<nav class="navbar">
<ul class="ul">
<li class="dashboard"><a class="dashboard2" href="admin.php">Dashboard</a></li>
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Notification</button>
<div id="myDropdown" class="dropdown-content">
<a href="notification.php">Add Notification</a>
<a href="notification1.php">View Notification</a>
</div>
</div>
<li class="view"><a class="view2" href="admin_view.php">View Reservation</a></li>
<li class="update"><a class="update2" href="reservation_status.php">Reservation Status</a></li>
<li class="delete"><a class="a_delete" href="admin_delete.php">Delete Reservation</a></li>
<li class="border-bottom"><a></a></li>
</ul>
</nav>
<p class="credential">Logged in as : <?php echo $_SESSION['user']; ?></p>
<a class="button_logout" href="admin_logout.php" name="logout">Log out</a>
<!-- edit -->
<h2 class="sure">Are you sure to delete?</h2>
<?php
//$identifier = '';
if(isset($_GET['form']))
{
//echo $_POST['Reservation_ID'];
//print_r($_POST);
$identifier = $_GET['Reservation_ID'];
$sql = "SELECT * FROM add_reservation WHERE reserve_id LIKE '$identifier'";
$result = mysqli_query($connection, $sql);
// table reservation+
echo "<div class=\"tablee\">";
if (mysqli_num_rows($result) > 0)
{
while ($row = mysqli_fetch_array($result)) {
?> <?php echo "<h3 class=\"hr\">Reservation Information</h3>"; ?>
<?php echo "Customer name: " . $row['username']; ?> <br><br>
<?php echo "Reservation id: " . $row['reserve_id']; ?> <br><br>
<?php echo "Total people: " . $row['no_of_people']; ?> <br><br>
<?php echo "Date: " . date('d/m/Y', strtotime($row['date'])); ?> <br><br>
<?php echo "Time: " . date('h:i a', strtotime($row['time'])); ?> <br><br>
<?php echo "Status: " . $row['status']; ?> <br><br>
<?php
}
}
echo "</div>";
//end table
echo "<div class=\"addform\">";
echo "<form method=\"get\" action=\"admin_deletedetail.php\">";
echo "<input type=\"hidden\" name=\"aa\" value=\"$identifier\">";
echo "<input class=\"deleteButton\" type=\"submit\" name=\"save\" value=\"YES\">";
echo "<input class=\"deleteButton1\" type=\"submit\" name=\"save1\" value=\"NO\"><br><br>";
echo "</form>";
echo "</div>";
}
?>
<script>
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
</body>
<?php
}
else
{
header("location: admin_login.php");
}
?>
</html>