-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct.php
90 lines (64 loc) · 2.13 KB
/
product.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
<?php
include("header.php");
$servername = "localhost";
$username = "root";
$password = "welcome1";
$dbname = "wpl";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
else
echo "Connected";
$sql = "SELECT pettype_id,typename,stock,price FROM pet";
$result = $conn->query($sql);
$out='';
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$out.="<div>id: " . $row["pettype_id"]. "<br />".$row["typename"]."<br />Price:".$row["price"]."<br />Stock :".$row["stock"]."<br /><input type='button' value='Add to cart' name='". $row["pettype_id"]."' /><br /><br /></div>";
}
}
$conn->close();
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/product_style.css">
<title>Products Page</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
var $prod= $('.product_main');
$prod.jScrollPane();
});
</script>
</head>
<body>
<div id="product_page">
<form class="category_filter" >
<fieldset><legend>Pet Type</legend>
<input type="checkbox" name="dogs" value="dogs">Dogs<br />
<input type="checkbox" name="cats" value="cats">Cats<br />
<input type="checkbox" name="fish" value="fish">Fish<br />
<input type="checkbox" name="fish" value="fish">Reptiles<br />
</fieldset>
</form>
<form class="price_filter" >
<fieldset><legend>Price Range</legend>
<input type="checkbox" name="0-25" value="25">$0-$25<br />
<input type="checkbox" name="25-50" value="50">$25-$50<br />
<input type="checkbox" name="51-75" value="75">$50-$75<br />
<input type="checkbox" name="75-100" value="100">$75-$100<br />
</fieldset>
</form>
</div>
<div class="product_main">
<?php echo $out; ?>
</div>
</body>
</html>