-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfood-search.php
175 lines (102 loc) · 4.23 KB
/
food-search.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
<?php include('./admin/constants.php'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Restaurant Website</title>
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />
<link rel="apple-touch-icon" sizes="180x180" href="./admin/favicon_io/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="./admin/favicon_io/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="./admin/favicon_io/favicon.ico">
<link rel="manifest" href="./admin/favicon_io/site.webmanifest">
<!-- font awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<!-- custom css file link -->
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!-- header section starts -->
<header>
<a href="<?php echo SITEURL; ?>" class="logo"><i class="fas fa-utensils"></i>restro.</a>
<nav class="navbar">
<a href="./foods.php">Foods</a>
<a href="./categories.php">Categories</a>
<a href="#order">order</a>
</nav>
<div class="icons">
<i class="fas fa-bars" id="menu-bars"></i>
<i class="fas fa-search" id="search-icon"></i>
<a href="#" class="fas fa-heart"></a>
<a href="#" class="fas fa-shopping-cart"></a>
</div>
</header>
<!-- header section ends-->
<!-- search form -->
<form action="./food-search.php" method="POST" id="search-form">
<div class="container">
<?php
$search = $_POST['search'];
?>
</div>
<input type="search" placeholder="search here..." name="search" id="search-box">
<h2>Foods on your search <a href="#" class="text-white">"<?php echo $search; ?>"</a></h2>
<label for="search-box" class="fas fa-search"></label>
<i class="fas fa-times" id="close"></i>
</form>
<section class="menu" id="menu">
<h3 class="sub-heading"> our menu </h3>
<h1 class="heading"> today's speciality </h1>
<div class="box-container">
<?php
$sql = "SELECT * FROM tbl_food WHERE title LIKE '%$search%' OR description LIKE '%$search%'";
$res = mysqli_query($conn, $sql);
$count = mysqli_num_rows($res);
if($count)
{
while($row=mysqli_fetch_assoc($res))
{
$id = $row['id'];
$title = $row['title'];
$price = $row['price'];
$description = $row['description'];
$image_name = $row['image_name'];
?>
<div class="box">
<div class="image">
<img src="./food/<?php echo $image_name; ?>" alt="">
<a href="#" class="fas fa-heart"></a>
</div>
<div class="content-b">
<div class="stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<h3><?php echo $title; ?></h3>
<p><?php echo $description; ?></p>
<span class="price">$<?php echo $price; ?></span>
<a href="./order.php?food_id=<?php echo $id; ?>" class="btn">Order Now</a>
</div>
</div>
<?php
}
}
else{
echo "<div class='error'>Food Not Available.</div>";
}
?>
</div>
</section>
<div class="loader-container">
<img src="images/loader.gif" alt="">
</div>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<!-- custom js file link -->
<script src="js/script.js"></script>
</body>
</html>
<!-- header section ends-->