-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathresults.php
93 lines (81 loc) · 3.29 KB
/
results.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
<?php
session_start();
require ("function.php");// Including the db Connection
if(!isset($_SESSION['cust_email'])){
echo "<script>window.open('login.php','_self')</script>";
}
else
{
?>
<html lang="en">
<head>
<title>E-Commerce</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse" style="border-radius:0px;">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Logo</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="home.php">Home</a></li>
<li class="active"><a href="menu.php">Food Menu</a></li>
<li><a href="stores.php">Stores</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
<ul
<ul class="nav navbar-nav navbar-right">
<li style="top:7px;">
<form class="form-inline my-2 my-lg-0" method="get" action="results.php" enctype="multipart/form-data">
<input class="form-control" type="search" name="user_query" placeholder="Search" aria-label="Search">
<button class="btn btn-primary" name="search" type="submit">Search</button>
</form>
</li>
<li><?php
if(!isset($_SESSION['cust_email'])){
echo "<a href='login.php'><span class='glyphicon glyphicon-user'></span> Login</a>";
}
else
{
echo "<a href='logout.php'><span class='glyphicon glyphicon-user'></span> Logout</a>";
}
?></li>
<li><a href="cart.php"><span class="glyphicon glyphicon-shopping-cart"></span> Cart</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<?php
if(isset($_GET['search'])){
$search_query =$_GET['user_query'];
$get_itm = $conn->query("select item_name,item_price,item_image from items where item_keywords like '%$search_query%'");
while($row = $get_itm->fetch(PDO::FETCH_ASSOC))
{
?>
<div class="col-sm-4">
<div class="panel panel-primary" style="border-radius:0px;">
<div class="panel-heading" align="center" style="border-radius:0px;"><b style="font-size:17px;"><?php echo $row['item_name']; ?></b></div>
<div class="panel-body" align="center" style="height:250px; width:350px; "><?php echo'<img src="'.$row['item_image'].'" alt="Image">'?></div>
<div class="panel-footer" align="center"><b style="font-size:15px;">Price : $<?php echo $row['item_price'];?></b></div>
<a href="menu.php?add_cart=$item_id"><button class="btn btn-secondary btn-lg btn-block" style="border-radius:0px;">Add to Cart</button></a></li>
</div>
</div>
<?php } }?>
</div>
</div>
</body>
</html>
<?php } ?>