-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.php
178 lines (163 loc) · 7 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
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatiblee" content="IE=edge,chrome=1" />
<!------상단메뉴용---------------------------->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="top_menu.js"></script>
<!------이미지슬라이드---------------------------->
<link rel="stylesheet" href="sidebar.css">
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="script.js"></script>
</head>
<body bgcolor="FFFAF6">
<header>
<div style="margin-left: 10%">
<table>
<tr> <td rowspan="3"> <img src="img/logo_top.png" width="500" height="300"></td><td><td></td></td><td></td></tr>
<tr><td rowspan="3"><img src="img/pink.png" width="100" height="300"></td><td></td><td></td><td><img src="img/pink.png" width="100" height="150"></td></tr>
<tr><td></td><td></td><td><img src="img/call.png" width="400" height="100"></td></td></td></tr>
</table>
</div>
<div id='cssmenu'>
<ul>
<li><a href='index.html'>Home</a></li>
<li><a href='intro.html'>회사소개</a></li>
<li class='active'><a href='product.php'>한우</a></li>
<li><a href='notice.php'>공지사항/FAQ</a></li>
<li><a href='bracket.php'>장바구니</a></li>
</ul>
</div>
</header>
<br>
<br>
<br>
<br>
<div id='content'>
<div id='sidebar' style="display:inline">
<ul>
<li class='active'><a href='product.php'>한우</a></li>
<li><a href='product.php?name=윗등심'>윗등심</a></li>
<li><a href='product.php?name=아랫등심'>아랫등심</a></li>
<li><a href='product.php?name=업진살'>업진살</a></li>
<li><a href='product.php?name=차돌박이'>차돌박이</a></li>
<li><a href='product.php?name=목심'>목심</a></li>
<li><a href='product.php?name=안심'>안심</a></li>
<li><a href='product.php?name=양지'>양지</a></li>
<li><a href='product.php?name=채끝'>채끝</a></li>
<li><a href='product.php?name=사골'>사골</a></li>
<li><a href='product.php?name=부채살'>부채살</a></li>
</ul>
</div>
<div id='list_1' style="display:inline">
<br>
<br>
<br>
<h1>한우</h1>
<hr>
<font size="5"><b>  조건 검색</b></font><br>
<form method="post" action="product.php">
<table>
<tr><td>
가격:
<input type="radio" name="chk_info1" value="10000" ondblclick="this.checked=false">~10000
<input type="radio" name="chk_info1" value="30000" ondblclick="this.checked=false">~30000
<input type="radio" name="chk_info1" value="50000" ondblclick="this.checked=false">~50000
<input type="radio" name="chk_info1" value="100000" ondblclick="this.checked=false">~100000<br>
</td>
<td rowspan="3"><input type="submit" class="search" value="검색"style="height:80px; width:80px;"></td></tr>
<tr><td>
용도:
<input type="radio" name="chk_info2" value="국거리" ondblclick="this.checked=false">국거리
<input type="radio" name="chk_info2" value="구이" ondblclick="this.checked=false">구이
<input type="radio" name="chk_info2" value="조림" ondblclick="this.checked=false">조림
<input type="radio" name="chk_info2" value="샤브샤브" ondblclick="this.checked=false">샤브샤브<br>
</td></tr>
<tr><td>
등급:
<input type="radio" name="chk_info3" value="A++" ondblclick="this.checked=false">A++
<input type="radio" name="chk_info3" value="A+" ondblclick="this.checked=false">A+
<input type="radio" name="chk_info3" value="A" ondblclick="this.checked=false">A
</td></tr>
</table>
</form>
<br>
<br>
<hr>
<table>
<?php
$servername = "203.253.146.133:3306";
$username = "changoul";
$password = "changoul";
$dbname = "Changoul";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if(isset($_POST["chk_info1"])){
if(isset($where)){
$where = $where." AND price < ".$_POST["chk_info1"];
} else {
$where = " WHERE price < ".$_POST["chk_info1"];
}
}
if(isset($_POST["chk_info2"])){
if(isset($where)){
$where = $where." AND purpose = '".$_POST["chk_info2"]."'";
} else {
$where = " WHERE purpose = '".$_POST["chk_info2"]."'";
}
}
if(isset($_POST["chk_info3"])){
if(isset($where)){
$where = $where." AND ranking = '".$_POST["chk_info3"]."'";
} else {
$where = " WHERE ranking = '".$_POST["chk_info3"]."'";
}
}
if(isset($where))
$sql = "SELECT title_no, name, price, picture, purpose FROM meat".$where;
else
$sql = "SELECT title_no, name, price, picture, purpose FROM meat";
} elseif (isset($_GET["name"])) {
$where = " WHERE name = '".$_GET["name"]."'";
$sql = "SELECT title_no, name, price, picture, purpose FROM meat".$where;
}else {
$sql = "SELECT title_no, name, price, picture, purpose FROM meat";
}
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
$row = $result->fetch_assoc();
while($row) {
?>
<tr>
<?php
for($i = 0; $i < 4 && $row; $i++) {
?>
<td>
<a href="bracket.php?num=<?php echo $row["title_no"];?>"><img src="<?php echo $row["picture"]?>" width="200" height="200" alt="gogi"></a><br>
<?php
echo $row["name"]. "<br>" . $row["price"]. "원<br>" . $row["purpose"]. "</td>";
?>
</td>
<?php
$row = $result->fetch_assoc();
}
?>
</tr>
<?php
}
}
?>
</table>
</div>
</div>
</body>
</html>