-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathproducts.php
193 lines (140 loc) · 7.56 KB
/
products.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
<!DOCTYPE html>
<html>
<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">
<script src="https://use.fontawesome.com/be1ba39dfe.js"></script>
<link rel="stylesheet" href="./css/product_style.css">
<title>Book Rental</title>
</head>
<body>
<?php include_once './includes/navbar.php'?>
<div class="section-body">
<div class="vertical-nav">
<ul style='display:flex;flex-direction:column'>
<h4 style='margin:0;padding-top:10px;z-index:3'><div style='display:flex;gap:5px;'> <button class='btn' style='font-size:14px'><a href="./products.php?type=new" style='text-decoration:none;color:white'>New</a></button><button class='btn' style='font-size:14px'><a href="./products.php?type=old" style='text-decoration:none;color:white'>Old</a></button> </div><p>
<u > <?php echo $_GET['type']==='new'? 'Rent New Books': 'Rent Old Books'?></u>
</p></h4>
<h4 style='margin-top:0;padding-top:0'><left>Category</left></h4>
<li><a href="#Adventure">Adventure</a></li>
<li><a href="#Thriller">Thriller</a></li>
<li><a href="#Romantic">Romantic</a></li>
<li><a href="#Comedy">Comedy</a></li>
</ul>
</div>
<div class="gallery-main" style="margin-left:25%;padding:1px 16px;height:1000px;">
<div class="Adventure" id="Adventure">
<h2>Adventure</h2>
<div class="gallery">
<?php
//this will dynamically fetch all related category data from a database
include "includes/config.php";
$sql = "SELECT * FROM books where book_type='{$_GET['type']}' AND book_catag='adventure'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
?>
<div class="image-holder">
<a style='text-decoration:none;color:black' href="./purchase.php?id=<?php echo $row['book_id']?>">
<img class='image' src="admin/upload/<?php echo $row['book_img'] ?>" alt="adventure-img">
<div class="desc">
Price : <?php echo $row['book_price'] ?>
<br>
<i class="fa fa-shopping-cart" aria-hidden="true"></i>
<button style='background:grey;color:white;border:none'>Rent</button>
</div> </a>
</div>
<?php }}else { echo "No Books Found"; }
$conn->close();
?>
</div>
<!-- Thriller -->
<div class="Thriller" id="Thriller">
<h2>Thriller</h2>
<div class="gallery">
<?php
//this will dynamically fetch all related category data from a database
include "includes/config.php";
$sql = "SELECT * FROM books where book_type='{$_GET['type']}' AND book_catag='thriller'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
?>
<div class="image-holder">
<a style='text-decoration:none;color:black' href="./purchase.php?id=<?php echo $row['book_id']?>">
<img class='image' src="admin/upload/<?php echo $row['book_img'] ?>" alt="adventure-img">
<div class="desc">
Price : <?php echo $row['book_price'] ?>
<br>
<i class="fa fa-shopping-cart" aria-hidden="true"></i>
<button style='background:grey;color:white;border:none'>Rent</button>
</div> </a>
</div>
<?php }}else { echo "No Books Found"; }
$conn->close();
?>
</div>
<!-- Romantic -->
<div class="Romantic" id="Romantic">
<h2>Romantic</h2>
<div class="gallery">
<?php
//this will dynamically fetch all related category data from a database
include "includes/config.php";
$sql = "SELECT * FROM books where book_type='{$_GET['type']}' AND book_catag='romantic'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
?>
<div class="image-holder">
<a style='text-decoration:none;color:black' href="./purchase.php?id=<?php echo $row['book_id']?>">
<img class='image' src="admin/upload/<?php echo $row['book_img'] ?>" alt="adventure-img">
<div class="desc">
Price : <?php echo $row['book_price'] ?>
<br>
<i class="fa fa-shopping-cart" aria-hidden="true"></i>
<button style='background:grey;color:white;border:none'>Rent</button>
</div> </a>
</div>
<?php }}else { echo "No Books Found"; }
$conn->close();
?>
</div>
<!-- Comedy -->
<div class="Comedy" id="Comedy">
<h2>Comedy</h2>
<div class="gallery">
<?php
//this will dynamically fetch all related category data from a database
include "includes/config.php";
$sql = "SELECT * FROM books where book_type='{$_GET['type']}' AND book_catag='comedy'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
?>
<div class="image-holder">
<a style='text-decoration:none;color:black' href="./purchase.php?id=<?php echo $row['book_id']?>">
<img class='image' src="admin/upload/<?php echo $row['book_img'] ?>" alt="adventure-img">
<div class="desc">
Price : <?php echo $row['book_price'] ?>
<br>
<i class="fa fa-shopping-cart" aria-hidden="true"></i>
<button style='background:grey;color:white;border:none'>Rent</button>
</div> </a>
</div>
<?php }}else { echo "No Books Found"; }
$conn->close();
?>
</div>
</div>
</div>
<br>
<right> <a href="./index.php" class="btn">Back <i class="fa fa-arrow-right" aria-hidden="true"></i> </a></right>
</div>
</body>
</html>