-
Notifications
You must be signed in to change notification settings - Fork 2
/
searchfood.php
318 lines (271 loc) · 10.9 KB
/
searchfood.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
<?php
include("connection.php");
extract($_REQUEST);
session_start();
if(isset($_SESSION['cust_id']))
{
$cust_id=$_SESSION['cust_id'];
$qq=mysqli_query($con,"select * from tblcustomer where fld_email='$cust_id'");
$qqr= mysqli_fetch_array($qq);
}
else
{
$cust_id="";
}
if(isset($food_id))
{
$fid= $food_id;
}
else
{
header("location:index.php");
}
if(isset($login))
{
header("location:form/index.php");
}
if(isset($logout))
{
session_destroy();
header("location:index.php");
}
if(isset($addtocart))
{
if(!empty($_SESSION['cust_id']))
{
header("location:form/cart.php?product=$addtocart");
}
else
{
header("location:form/?product=$addtocart");
}
}
$query=mysqli_query($con,"select tbfood.foodname,tbfood.fldvendor_id,tbfood.cost,tbfood.cuisines,tbfood.fldimage,tblcart.fld_cart_id,tblcart.fld_product_id,tblcart.fld_customer_id from tbfood inner join tblcart on tbfood.food_id=tblcart.fld_product_id where tblcart.fld_customer_id='$cust_id'");
$re=mysqli_num_rows($query);
?>
<html>
<head>
<title>Home</title>
<!--bootstrap files-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!--bootstrap files-->
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Great+Vibes|Permanent+Marker" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Tangerine">
<script>
//search product function
$(document).ready(function(){
$("#search_text").keypress(function()
{
load_data();
function load_data(query)
{
$.ajax({
url:"fetch2.php",
method:"post",
data:{query:query},
success:function(data)
{
$('#result').html(data);
}
});
}
$('#search_text').keyup(function(){
var search = $(this).val();
if(search != '')
{
load_data(search);
}
else
{
$('#result').html(data);
}
});
});
});
//hotel search
$(document).ready(function(){
$("#search_hotel").keypress(function()
{
load_data();
function load_data(query)
{
$.ajax({
url:"fetch.php",
method:"post",
data:{query:query},
success:function(data)
{
$('#resulthotel').html(data);
}
});
}
$('#search_hotel').keyup(function(){
var search = $(this).val();
if(search != '')
{
load_data(search);
}
else
{
load_data();
}
});
});
});
</script>
<style>
#aboutus{
background-image:url("img/main_spice2.jpg");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
ul li {list-style:none;}
ul li a{color:black; font-weight:bold;}
ul li a:hover{text-decoration:none;}
</style>
</head>
<body>
<div id="result" style="position:fixed;top:100; right:50;z-index: 3000;width:350px;background:white;"></div>
<nav class="navbar navbar-expand-lg navbar-light bg-dark fixed-top">
<a class="navbar-brand" href="index.php"><span style="color:green;font-family: 'Permanent Marker', cursive;">Food Hunt</span></a>
<?php
if(!empty($cust_id))
{
?>
<a class="navbar-brand" style="color:white; text-decoratio:none;"><i class="far fa-user"><?php if(isset($cust_id)) { echo $qqr['fld_name']; }?></i></a>
<?php
}
?>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a href="index.php" style="color:white;" class="nav-link">Home</a>
</li>
<li class="nav-item">
<a href="aboutus.php" style="color:white;" class="nav-link">About Us</a>
</li>
<li class="nav-item">
<a href="services.php" style="color:white;" class="nav-link">Services</a>
</li>
<li class="nav-item">
<a href="contact.php" style="color:white;" class="nav-link">Contact Us</a>
</li>
<?php
if(empty($cust_id))
{
?>
<li class="nav-item">
<a href="form/index.php?msg=you must be login first" class="nav-link"><span style="color:red; font-size:30px;"><i class="fa fa-shopping-cart" aria-hidden="true"><span style="color:red;" id="cart" class="badge badge-light">0</span></i></span></a>
</li>
<li class="nav-item">
<a class="nav-link"><form method="post"><button class="btn btn-outline-danger my-2 my-sm-0" name="login" type="submit">Log In</button></form></a>
</li>
<?php
}
else
{
?>
<li class="nav-item">
<a href="form/cart.php" class="nav-link"><form method="post"><span style=" color:green; font-size:30px;"><i class="fa fa-shopping-cart" aria-hidden="true"><span style="color:green;" id="cart" class="badge badge-light"><?php if(isset($re)) { echo $re; }?></span></i></span></form></a>
</li>
<li class="nav-item">
<a class="nav-link"><form method="post"><button class="btn btn-outline-success my-2 my-sm-0" name="logout" type="submit">Log Out</button></form></a>
</li>
<?php
}
?>
</ul>
</div>
</nav>
<br><br><br><br>
<!--menu ends-->
<div class="container-fluid" >
<br><br>
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-6" >
<?php
$query=mysqli_query($con,"select tblvendor.fld_email,tblvendor.fld_name,tblvendor.fld_mob,
tblvendor.fld_phone,tblvendor.fld_address,tblvendor.fld_logo,tbfood.foodname,tbfood.cost,
tbfood.cuisines,tbfood.paymentmode,tbfood.fldimage from tblvendor inner join
tbfood on tblvendor.fldvendor_id=tbfood.fldvendor_id where tbfood.food_id='$fid'");
if(mysqli_num_rows($query))
{
while($res=mysqli_fetch_assoc($query))
{
$hotel_logo= "image/restaurant/".$res['fld_email']."/".$res['fld_logo'];
$food_pic= "image/restaurant/".$res['fld_email']."/foodimages/".$res['fldimage'];
?>
<div class="container-fluid">
<div class="container-fluid">
<div class="row" style="padding-top:10px; ">
<div class="col-sm-2"><img src="<?php echo $hotel_logo; ?>" class="rounded-circle" height="50px" width="50px" alt="Cinque Terre"></div>
<div class="col-sm-6">
<span style="font-family: 'Miriam Libre', sans-serif; font-size:18px;color:#CB202D;">
<?php echo $res['fld_name']; ?></span><span style="color:black; margin-left:10px;"><i class="far fa-star"></i><i class="far fa-star"></i><i class="far fa-star"></i></span>
</div>
<div class="col-sm-2"><i class="fas fa-rupee-sign"></i><span style="color:green; font-size:20px;"> <?php echo $res['cost']; ?></span></div>
<form method="post">
<div class="col-sm-2" style="text-align:left;padding:10px; font-size:15px;"><button type="submit" name="addtocart" value="<?php echo $fid; ?>")" ><span style="color:green;" <i class="fa fa-shopping-cart" aria-hidden="true"></i></span></button></div>
</form>
</div>
</div>
<div class="container-fluid">
<div class="row" style="padding:10px;padding-top:0px;padding-right:0px; padding-left:0px;">
<div class="col-sm-12"><img src="<?php echo $food_pic; ?>" class="rounded" height="400px" width="100%" alt="Cinque Terre"></div>
</div>
</div>
<div class="container-fluid">
<div class="row" style="padding:10px; ">
<div class="col-sm-5">
<span><li><?php echo $res['cuisines']; ?></li></span>
<span><li><?php echo "Rs ".$res['cost']; ?> for 1</li></span>
<span><li>Up To 60 Minutes</li></span>
</div>
<div class="col-sm-6" style="">
<b><?php echo"(" .$res['foodname'].")"?></b>
</div>
</div>
</div>
<?php
}
}
else
{
?>
<div class="row"><div class="col-sm-12" style="color:red;"><?php echo "sorry No Record Found For This Order";?></div></div>
<?php
}
?>
</div>
</div>
<div class="col-sm-3"></div>
</div>
</div>
<br><br>
<div class="container">
<div class="row">
<div class="col-sm-4">
</div>
<div class="col-sm-4">
</div>
<div class="col-sm-4">
</div>
</div>
</div>
<!--footer primary-->
<?php
include("footer.php");
?>
</body>
</html>