-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproductMenu.php
More file actions
141 lines (128 loc) · 4.61 KB
/
Copy pathproductMenu.php
File metadata and controls
141 lines (128 loc) · 4.61 KB
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
<?php
session_start();
require 'db.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AgriLink</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="bootstrap\css\bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="bootstrap\js\bootstrap.min.js"></script>
<!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
<link rel="stylesheet" href="login.css"/>
<script src="js/jquery.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/skel-layers.min.js"></script>
<script src="js/init.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-xlarge.css" />
</noscript>
<!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" /><![endif]-->
</head>
<body class>
<?php
require 'menu.php';
function dataFilter($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<!-- One -->
<section id="main" class="wrapper style1 align-center" >
<div class="container">
<h2>Welcome to digital market</h2>
<?php
if(isset($_GET['n']) AND $_GET['n'] == 1):
?>
<h3>Select Filter</h3>
<form method="GET" action="productMenu.php?">
<input type="text" value="1" name="n" style="display: none;"/>
<center>
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-2">
<div class="select-wrapper" style="width: auto" >
<select name="type" id="type" required style="background-color:white;color: black;">
<option value="all" style="color: black;">List All</option>
<option value="fruit" style="color: black;">Fruit</option>
<option value="vegetable" style="color: black;">Vegetable</option>
<option value="grain" style="color: black;">Grains</option>
</select>
</div>
</div>
<div class="col-sm-2">
<input class="button special" type="submit" value="Go!" />
</div>
<div class="col-sm-4"></div>
</div>
</center>
</form>
<?php endif; ?>
<section id="two" class="wrapper style2 align-center">
<div class="container">
<?php
if(!isset($_GET['type']) OR $_GET['type'] == "all")
{
$sql = "SELECT fp.*, f.fname
FROM fproduct fp
JOIN farmer f ON fp.fid = f.fid
WHERE fp.fid IS NOT NULL";
}
if(isset($_GET['type']) AND $_GET['type'] == "fruit")
{
$sql = "SELECT fp.*, f.fname
FROM fproduct fp
JOIN farmer f ON fp.fid = f.fid
WHERE fp.pcat = 'Fruit' AND fp.fid IS NOT NULL";
}
if(isset($_GET['type']) AND $_GET['type'] == "vegetable")
{
$sql = "SELECT fp.*, f.fname
FROM fproduct fp
JOIN farmer f ON fp.fid = f.fid
WHERE fp.pcat = 'Vegetable' AND fp.fid IS NOT NULL";
}
if(isset($_GET['type']) AND $_GET['type'] == "grain")
{
$sql = "SELECT fp.*, f.fname
FROM fproduct fp
JOIN farmer f ON fp.fid = f.fid
WHERE fp.pcat = 'Grains' AND fp.fid IS NOT NULL";
}
$result = mysqli_query($conn, $sql);
?>
<div class="row">
<?php
while($row = $result->fetch_array()):
$picDestination = "images/productImages/".$row['pimage'];
?>
<div class="col-md-4">
<section>
<strong><h2 class="title" style="color:black; "><?php echo $row['product'].'';?></h2></strong>
<a href="review.php?pid=<?php echo $row['pid'] ;?>" > <img class="image fit" src="<?php echo $picDestination;?>" height="220px;" /></a>
<div style="align: left">
<blockquote>
<?php echo "Type : ".$row['pcat'].'';?><br>
<?php echo "Price : KES ".$row['price'].'';?><br>
<?php echo "Farmer : ".$row['fname'].'';?><br>
</blockquote>
</div>
</section>
</div>
<?php endwhile; ?>
</div>
</section>
</header>
</section>
</body>
</html>