-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
49 lines (40 loc) · 1.57 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
<?php
ob_start();
include 'inc/navbar.php';
$query = 'SELECT * from food_items';
$result = mysqli_query($conn, $query);
$food_items = mysqli_fetch_all($result, MYSQLI_ASSOC);
ob_end_flush();
?>
<div>
<div class="home-banner">
<div class="search">
<form action="search.php" method="GET">
<div><input type="text" name="search" placeholder="Search for food"> <i class="fa-solid fa-magnifying-glass"></i></div>
<input type="submit" name="submit">
</form>
</div>
</div>
<div class="food-items-container">
<h1>Food Menus</h1>
<div class="food-items">
<?php
foreach ($food_items as $item) {
?>
<div data-id="<?php echo $item['id'] ?>" class="item">
<img id="item-image" src="<?php echo $item['image'] ?>" alt="<?php echo $item['title'] ?>">
<div>
<h3 id="item-title"><?php echo $item['title']; ?></h3>
<p id="item-price">Rs. <?php echo $item['price']; ?></p>
<span><?php echo $item['availability'] ? 'Available' : 'Not available'; ?></span>
<input type="number" id="item-quantity" name="quantity" value="1" min=1 >
<input type="submit" value="Add to cart" onclick="handleAddToCart(event, <?php echo $item['id'] ?>);" readonly>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php include 'inc/footer.php'; ?>