forked from Biplob14/Restaurant-Finding-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
344 lines (268 loc) · 12.6 KB
/
index.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<?php include "header.php" ?>
<?php include "server_connect.php" ?>
<style type="text/css">
body{
background: url("resource/f2.jpg") no-repeat;
background-size: cover;
z-index: -1;
opacity: 1;
}
div>label{
color:#0dc0ea;
}
.result-table{
color:#0dc0ea;
font-size: 1.6rem;
}
.result-table>a{
font-size:1.8rem;
}
#wrap{
margin-bottom: 6%;
}
.checked {
color: orange;
}
#map{
height: 100%;
}
</style>
<div class="container" id="wrap">
<div class="row">
<div class="col-lg-6">
<div class="col-lg-6 maps">
<div class="map-responsive" style="width: 500px;height: 600px;">
<div id="map"></div>
<?php include "map.php" ?>
</div>
</div>
</div>
<div class="col-lg-6">
<form action="index.php" method="post">
<div class="form-group">
<label for="">Resturant</label>
<input type="text" class="form-control" id="" placeholder="Resturant name" name="r_name">
</div>
<div class="form-group">
<label for="pwd">Price Range</label>
<input type="text" class="form-control" id="pwd" placeholder="Price Range" name="food_price">
</div>
<div class="form-group">
<label for="sel1">Food Item (select one):</label>
<select class="form-control" id="sel1" name="food_item">
<option></option>
<?php
$query = "SELECT * FROM menu";
$posts=mysqli_query($db,$query);
while ($row=mysqli_fetch_assoc($posts)) {
// $user_index = $row['id'];
$food_name = $row['food_name'];
echo "<option value = "; echo str_replace(' ', '_', $food_name); echo ">{$food_name}</option> ";
}
?>
</select>
</div>
<button type="submit" name="submit" value="submit" class="btn btn-primary center-block">Submit</button>
</form>
<hr>
</br>
<div class="result-table">
<table class="table table-hover table-striped">
<?php
// if (isset($_POST['submit'])) {
// $r_name = $_POST['r_name'];
// $food_price = $_POST['food_price'];
// $food_name = $_POST['food_item'];
// if ($r_name !=="" || $food_price !=="" || $food_name!=="") {
// for all selection
// if (isset($_POST['r_name'], $_POST['food_item'], $_POST['food_price']) ) {
// $query = "SELECT * FROM r_signup WHERE r_name = '$r_name' OR food_name = '$food_name' OR food_price >= '$food_price'";
// $data = mysqli_query($db, $query);
// echo "for three query";
// echo $food_price;
// echo $food_name;
// while ($row = mysqli_fetch_assoc($data)) {
// $r_name = $row['r_name'];
// $r_address = $row['r_address'];
// $rating = $row['rating'];
// echo "<tr>";
// echo "<td> <a href = 'restaurant_home.php?name=$r_name'>{$r_name}</a></td>";
// echo "<td>{$rating} <span class='fa fa-star checked'></span> </td>";
// echo "<td>{$r_address}</td>";
// // <span class="fa fa-star checked"></span>
// // <span class="fa fa-star checked"></span>
// // <span class="fa fa-star checked"></span>
// // <span class="fa fa-star checked"></span>
// // <span class="fa fa-star"></span>
// echo "</tr>";
// }
// }
// for restaurant name and food name selection
// else if (isset($r_name) AND isset($food_name)) {
// $query = "SELECT * FROM r_signup WHERE r_name = '$r_name' OR food_name = '$food_name'";
// $data = mysqli_query($db, $query);
// while ($row = mysqli_fetch_assoc($data)) {
// $r_name = $row['r_name'];
// $r_address = $row['r_address'];
// $rating = $row['rating'];
// echo "for two query r_name and food_name";
// echo "<tr>";
// echo "<td> <a href = 'restaurant_home.php?name=$r_name'>{$r_name}</a></td>";
// echo "<td>{$rating} <span class='fa fa-star checked'></span> </td>";
// echo "<td>{$r_address}</td>";
// // <span class="fa fa-star checked"></span>
// // <span class="fa fa-star checked"></span>
// // <span class="fa fa-star checked"></span>
// // <span class="fa fa-star checked"></span>
// // <span class="fa fa-star"></span>
// echo "</tr>";
// }
// }
// }
// obsolete code
// else
// include"restaurant_list.php";
if (isset($_POST['submit'])) {
$r_names = $_POST['r_name'];
$food_prices = $_POST['food_price'];
$food_names = $_POST['food_item'];
if ($r_names != "" || $food_prices != "" || $food_names !="") {
$query = "SELECT * FROM r_signup WHERE r_name = '$r_names' OR food_name = '$food_names' OR food_price >= '$food_prices'";
$data = mysqli_query($db, $query);
if (mysqli_num_rows($data)>0) {
while ($row = mysqli_fetch_assoc($data)) {
$r_name = $row['r_name'];
$r_address = $row['r_address'];
$rating = $row['rating'];
$food_name = $row['food_name'];
$food_price = $row['food_price'];
$food_names = str_replace("_", " ", $food_names);
// echo $food_names."sssssssssssssssssss";
// var_dump($r_names);
// var_dump($food_prices);
// var_dump($food_names);
// echo $food_prices."Taka";
// for restaurant name input
if($r_names == $r_name && $food_names == "" && $food_prices == ""){
// echo "for r_names";
echo "<tr>";
echo "<td> <a href = 'restaurant_home.php?name=$r_name'>{$r_name}</a></td>";
echo "<td>{$rating} <span class='fa fa-star checked'></span> </td>";
echo "<td>{$r_address}</td>";
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star"></span>
echo "</tr>";
}
// for price input
elseif ($r_names == "" && $food_names == "" && $food_prices !=="") {
if ($food_price>=$food_prices) {
// echo "price filter";
echo "<tr>";
echo "<td> <a href = 'restaurant_home.php?name=$r_name'>{$r_name}</a></td>";
echo "<td>{$rating} <span class='fa fa-star checked'></span> </td>";
echo "<td>{$r_address}</td>";
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star"></span>
echo "</tr>";
}
}
// food name filter
elseif ($r_names =="" && $food_names == $food_name && $food_prices == "") {
// echo "food name filterrrrrrrrrrrrrrrrrrr";
echo "<tr>";
echo "<td> <a href = 'restaurant_home.php?name=$r_name'>{$r_name}</a></td>";
echo "<td>{$rating} <span class='fa fa-star checked'></span> </td>";
echo "<td>{$r_address}</td>";
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star"></span>
echo "</tr>";
}
// restaurant name and food name filter
elseif ($r_names === $r_name && $food_names === $food_name && $food_prices === "") {
// echo "restaurant name and food name filterccccc";
echo "<tr>";
echo "<td> <a href = 'restaurant_home.php?name=$r_name'>{$r_name}</a></td>";
echo "<td>{$rating} <span class='fa fa-star checked'></span> </td>";
echo "<td>{$r_address}</td>";
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star"></span>
echo "</tr>";
}
//restaurant name and food price
elseif ($r_names === $r_name && $food_prices !=="" && $food_names === "") {
if ($food_price>=$food_prices) {
// echo "restaurant name and food price search";
echo "<tr>";
echo "<td> <a href = 'restaurant_home.php?name=$r_name'>{$r_name}</a></td>";
echo "<td>{$rating} <span class='fa fa-star checked'></span> </td>";
echo "<td>{$r_address}</td>";
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star"></span>
echo "</tr>";
}
}
//food name and food price search
elseif ($r_names === "" && $food_prices !=="" && $food_names === $food_name) {
if ($food_price>=$food_prices) {
// echo "food name and food price search";
echo "<tr>";
echo "<td> <a href = 'restaurant_home.php?name=$r_name'>{$r_name}</a></td>";
echo "<td>{$rating} <span class='fa fa-star checked'></span> </td>";
echo "<td>{$r_address}</td>";
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star"></span>
echo "</tr>";
}
}
elseif ($r_names === $r_name && $food_names === $food_name && $food_prices !=="" ) {
if ($food_price>=$food_prices) {
// echo "food name and food price search";
//
echo "<tr>";
echo "<td> <a href = 'restaurant_home.php?name=$r_name'>{$r_name}</a></td>";
echo "<td>{$rating} <span class='fa fa-star checked'></span> </td>";
echo "<td>{$r_address}</td>";
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star checked"></span>
// <span class="fa fa-star"></span>
echo "</tr>";
}
}
}
}
}
if ($r_names == "" && $food_names == "" && $food_prices == "") {
echo "<p class='text-center'> <img src='resource/not_found.png' height='300px' width='300px'></p>";
echo "<p class='text-center'><b><-------Please Fill any field and search-------></b>";
}
}
else
include "restaurant_list.php";
?>
</table>
</div>
</div>
</div>
</div>
</body>
<?php include "footer.php" ?>