-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay-stadium.php
213 lines (178 loc) · 4.16 KB
/
display-stadium.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php
session_start();
include_once 'dbConn.php';
include_once 'h-admin.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Stadium</title>
<style type="text/css">
body{
margin:0px;
padding: 0px;
font-family: sans-serif;
}
.new{
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.add-new-product{
width: 800px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
}
.add-new-product img{
margin-top: 5px;
height: 30px;
width: 30px;
}
.add-new-product a{
display: flex;
flex-direction: row-reverse;
text-decoration: none;
color: white;
}
.add-label{
border-radius: 10px;
margin-left: -10px;
text-align: center;
padding: 10px;
background-color: #6abd7a;
}
.all-item{
margin: 50px;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.item{
width: 800px;
border: 1px solid gray;
border-radius: 10px;
display: flex;
flex-direction: row;
padding: 10px;
}
.item-img img{
width: 100px;
height: 100px;
}
.item-desc-price-quantity{
width: 350px;
margin: 15px 30px;
}
.item-desc, .item-price, .item-quantity{
margin-top: 5px;
}
.item-update{
margin: 20px 5px;
}
.input-num{
border-radius: 10px;
text-align: center;
margin-top: 5px;
border: 1px solid gray;
width: 180px;
height: 30px;
}
.button-submit{
border: 1px transparent;
box-shadow: 0px 0px 5px lightgray;
border-radius: 10px;
height: 30px;
width: 100px;
margin-top: 5px;
margin-left: 40px;
background-color: #6abd7a;
color: white;
}
.button-submit a{
color: white;
}
.button-delete a{
color:white;
}
.button-delete{
border: 1px transparent;
box-shadow: 0px 0px 5px lightgray;
border-radius: 10px;
height: 30px;
width: 100px;
margin-top: 5px;
margin-left: 40px;
background-color: #f71735;
color: white;
}
.button-delete:hover{
background-color: #42cef5;
box-shadow: 0px 0px 5px black;
}
.button-submit:hover{
background-color: #42cef5;
box-shadow: 0px 0px 5px black;
}
</style>
</head>
<body>
<div class="title-page">
<center><h1>STADIUM</h1></center>
</div>
<div class="new">
<div class="add-new-product">
<div class="add-button">
<a href="addStadium.php">
<div class="add-label">Add New Stadium</div>
<img src="image/add.png">
</a>
</div>
</div>
</div>
<div class="update-form">
<?php
$class_items = "SELECT * FROM stadium;";
$result = mysqli_query($conn, $class_items);
while ($record = mysqli_fetch_assoc($result)) {
?>
<div class="all-item">
<div class="item">
<div class="item-img">
<img src="<?php echo $record['stadiumLayout']; ?>">
</div>
<div class="item-desc-price-quantity">
<div>Stadium ID : <?php echo $record['stadiumID']; ?></div>
<div class="item-desc"><?php echo $record['stadiumName']; ?></div>
<div class="item-price">Section <?php echo $record['section']; ?></div>
<div class="item-quantity">RM <?php echo $record['price']; ?></div>
<div class="item-quantity">Seat : <?php echo $record['seat']; ?></div>
</div>
<div class="item-update">
<!--<input type="hidden" name="product_ID" value="<?php //echo $record['product_ID']; ?>">-->
<!--<input type="number" name="item_add" class="input-num" min="0" placeholder="Enter additional ammount"><br>-->
<button type="submit" class="button-submit"><a href="update-stadium.php?stadium-id=<?php echo $record['stadiumID']; ?>§ion=<?php echo $record['section']; ?>">Update</a></button>
<button type="submit" class="button-delete"><a href="display-stadium.php?action=delete&bil=<?php echo $record['bil']; ?>">Delete</a></button>
</div>
</div>
</div>
<?php
}
?>
</div>
</body>
</html>
<?php
if(isset($_GET['action'])){
if($_GET['action'] == "delete") {
$bil = $_GET['bil'];
$sql = "DELETE FROM stadium WHERE bil = '$bil';";
$result = mysqli_query($conn,$sql);
if($result > 0){
echo "<script>alert('Stadium successfully deleted');";
echo "window.location.href = 'display-stadium.php';</script>";
}
}
}
?>