forked from dhruvkayastha/FreshProduce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_requirements.php
91 lines (81 loc) · 2.59 KB
/
view_requirements.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
<html>
<head>
<title>Market Requirements | FreshProduce</title>
</head>
<body>
<style>
table, th, td {
border: 1px solid black;
/*border-collapse: collapse;*/
}
th, td {
padding: 5px;
}
</style>
<html>
<head>
<meta charset="UTF-8">
<title>Requirements | FreshProduce</title>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<div class="fb-header">
<div id="img1" class="fb-header"><a href="farmer.php"><img border="0" alt="FreshProduce" src="icon4.jpeg" width="150" height="150"></a></div>
<form name="loginForm" method="post" action="signout.php">
<div id="form1" class="fb-header">
<!-- <input type="text" placeholder="Email" name="email" id="email" pattern = "[A-Za-z0-9_\-]+@[A-Za-z]+\.[A-Za-z]{2,}" required> -->
</div>
<div id="form2" class="fb-header">
<!-- <input type="password" placeholder="Password" name="pass" id="pass" onkeyup="pwChecker()" required> -->
</div>
<input type="submit" class="submit1" value="Sign out" />
</form>
</div>
<div class='afg'>
<?php
require_once 'dbconnect.php';
$query = "SELECT crop_id, crop_name, crop_type, quantity FROM requirements JOIN crops USING(crop_id) WHERE 1=1 ";
foreach ($_GET as $key => $value)
{
if($value != "")
{
$query=$query."AND ".substr($key, 2)."='".$value."' ";
}
}
echo "<br>Requirements<br><br>";
$result = mysqli_query($con, $query);
if($result!==false)
{
echo "<table>";
echo "<tr><th>Stock ID</th><th>Crop Name</th><th>Crop Type</th><th>Quantity</th></tr>";
while($row = mysqli_fetch_assoc($result))
{
echo "<tr>";
foreach($row as $cname => $cvalue)
{
echo "<td>$cvalue</td>";
}
echo "</tr>";
}
echo "</table><br><br>";
}
else
{
echo "No specified requirements in market";
}
echo "<br><br>"
?>
<form action="?" method="get">
<input type="text" name="f_crop_id" id="f_crop_id" pattern="[0-9]{1,8}" title="Enter numeric ID" placeholder="Crop ID">
<input type="text" name="f_crop_name" id="f_crop_name" pattern="[A-Za-z]{1,}" placeholder="Crop Name">
<input type="text" name="f_crop_type" id="f_crop_type" pattern="[A-Za-z]{1,}" placeholder="Crop Type">
<input type="text" name="f_quantity>" id="f_quantity>" pattern="[0-9]{1,8}" placeholder="Quantity Lower Bound">
<input type="text" name="f_quantity<" id="f_quantity<" pattern="[0-9]{1,8}" placeholder="Upper Bound Quantity">
<button type="submit">Filter</button>
</form>
<br><br>
<br><br><br>
<!-- <a href="farmer.php">Click here to go back</a> -->
</div>
</body>
</html>