-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathour-menu.php
216 lines (185 loc) · 8.29 KB
/
our-menu.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
<?php
session_start();
include_once('includes/dbconnection.php');
if(isset($_POST['addcart']))
{
$foodid=$_POST['foodid'];
$foodqty=$_POST['foodqty'];
$userid= $_SESSION['fosuid'];
$query=mysqli_query($con,"insert into tblorders(UserId,FoodId,FoodQty) values('$userid','$foodid','$foodqty') ");
if($query)
{
echo "<script>alert('Food has been added in to the cart');</script>";
} else {
echo "<script>alert('Something went wrong.');</script>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="" />
<meta name="keywords" content="" />
<title>Food Ordering System</title>
<link rel="shortcut icon" href="assets/images/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="assets/css/icons.min.css">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/main.css">
<link rel="stylesheet" href="assets/css/red-color.css">
<link rel="stylesheet" href="assets/css/yellow-color.css">
<link rel="stylesheet" href="assets/css/responsive.css">
</head>
<body itemscope>
<?php include_once('includes/header.php');?>
<section>
<div class="block">
<div class="fixed-bg" style="background-image: url(assets/images/topbg.jpg);"></div>
<div class="page-title-wrapper text-center">
<div class="col-md-12 col-sm-12 col-lg-12">
<div class="page-title-inner">
<h1 itemprop="headline">Our Menu</h1>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="block less-spacing gray-bg top-padd30">
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12 col-lg-12">
<div class="sec-box">
<div class="remove-ext">
<div class="row">
<?php
if (isset($_GET['page_no']) && $_GET['page_no']!="") {
$page_no = $_GET['page_no'];
} else {
$page_no = 1;
}
$total_records_per_page = 12;
$offset = ($page_no-1) * $total_records_per_page;
$previous_page = $page_no - 1;
$next_page = $page_no + 1;
$adjacents = "2";
$result_count = mysqli_query($con,"SELECT COUNT(*) As total_records FROM tblfood");
$total_records = mysqli_fetch_array($result_count);
$total_records = $total_records['total_records'];
$total_no_of_pages = ceil($total_records / $total_records_per_page);
$second_last = $total_no_of_pages - 1; // total page minus 1
$result = mysqli_query($con,"SELECT * FROM tblfood LIMIT $offset, $total_records_per_page");
while($row = mysqli_fetch_array($result)){
?>
<div class="col-md-4 col-sm-6 col-lg-4">
<div class="popular-dish-box style2 wow fadeIn" data-wow-delay="0.2s">
<div class="popular-dish-thumb">
<a href="food-detail.php?fid=<?php echo $row['ID'];?>" title="" itemprop="url"><img src="admin/itemimages/<?php echo $row['Image'];?>" alt="<?php echo $row['ItemName'];?>" itemprop="image" width="400" height="180"></a>
</div>
<div class="popular-dish-info">
<h4 itemprop="headline"><a href="food-detail.php?fid=<?php echo $row['ID'];?>" title="" itemprop="url"><?php echo $row['ItemName'];?></a></h4>
<form method="post">
<p itemprop="description">
<input type="hidden" name="foodid" value="<?php echo $row['ID'];?>">
<input class="qty" name="foodqty" type="text" value="1">
</p>
<span class="price">Rs. <?php echo $row['ItemPrice'];?></span>
<?php if($_SESSION['fosuid']==""){?>
<a class="log-popup-btn btn pull-right red-bg brd-rd3" href="#" title="Login">Order Now</a>
<?php } else {?>
<button type="submit" name="addcart" class="btn pull-right red-bg brd-rd3">Order Now</button>
<?php } ?>
</form>
</div>
</div><!-- Popular Dish Box -->
</div>
<?php } ?>
</div>
</div>
<div class="pagination-wrapper text-center">
<ul class="pagination justify-content-center">
<!--
<ul class="pagination"> -->
<?php // if($page_no > 1){ echo "<li><a href='?page_no=1'>First Page</a></li>"; } ?>
<li class="page-item prev" <?php if($page_no <= 1){ echo "class='disabled'"; } ?>>
<a class="page-link brd-rd2" <?php if($page_no > 1){ echo "href='?page_no=$previous_page'"; } ?>>Previous</a>
</li>
<?php
if ($total_no_of_pages <= 10){
for ($counter = 1; $counter <= $total_no_of_pages; $counter++){
if ($counter == $page_no) {
echo "<li class='active'><a>$counter</a></li>";
}else{
echo "<li><a href='?page_no=$counter'>$counter</a></li>";
}
}
}
elseif($total_no_of_pages > 10){
if($page_no <= 4) {
for ($counter = 1; $counter < 8; $counter++){
if ($counter == $page_no) {
echo "<li class='active'><a>$counter</a></li>";
}else{
echo "<li><a href='?page_no=$counter'>$counter</a></li>";
}
}
echo "<li><a>...</a></li>";
echo "<li><a href='?page_no=$second_last'>$second_last</a></li>";
echo "<li><a href='?page_no=$total_no_of_pages'>$total_no_of_pages</a></li>";
}
elseif($page_no > 4 && $page_no < $total_no_of_pages - 4) {
echo "<li><a href='?page_no=1'>1</a></li>";
echo "<li><a href='?page_no=2'>2</a></li>";
echo "<li><a>...</a></li>";
for ($counter = $page_no - $adjacents; $counter <= $page_no + $adjacents; $counter++) {
if ($counter == $page_no) {
echo "<li class='active'><a>$counter</a></li>";
}else{
echo "<li><a href='?page_no=$counter'>$counter</a></li>";
}
}
echo "<li><a>...</a></li>";
echo "<li><a href='?page_no=$second_last'>$second_last</a></li>";
echo "<li><a href='?page_no=$total_no_of_pages'>$total_no_of_pages</a></li>";
}
else {
echo "<li><a href='?page_no=1'>1</a></li>";
echo "<li><a href='?page_no=2'>2</a></li>";
echo "<li><a>...</a></li>";
for ($counter = $total_no_of_pages - 6; $counter <= $total_no_of_pages; $counter++) {
if ($counter == $page_no) {
echo "<li class='active'><a>$counter</a></li>";
}else{
echo "<li><a href='?page_no=$counter'>$counter</a></li>";
}
}
}
}
?>
<li class="page-item next" <?php if($page_no >= $total_no_of_pages){ echo "class='disabled'"; } ?>>
<a class="page-link brd-rd2" <?php if($page_no < $total_no_of_pages) { echo "href='?page_no=$next_page'"; } ?>>Next</a>
</li>
<?php if($page_no < $total_no_of_pages){ ?>
<li class="page-item next"><a class="page-link brd-rd2" href='?page_no=<?php echo $total_no_of_pages;?>'>Last ››</a></li>
<?php
} ?>
</ul>
</div><!-- Pagination Wrapper -->
</div>
</div>
</div>
</div>
</div>
</section>
<?php include_once('includes/footer.php');
include_once('includes/signin.php');
include_once('includes/signup.php');
?>
</main><!-- Main Wrapper -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/plugins.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>