我想问一下如何通过 3 个下拉列表独立过滤我的结果。例如,我将按 1 个下拉列表对其进行过滤,然后当我选择另一个下拉列表时,它会细化与我选择第 3 个下拉列表时相同的结果。
这是我的filtering.php代码:
<?php
$q=$_GET['q'];
$a=$_GET['a'];
$b=$_GET['b'];
$con = mysql_connect('localhost', 'root', '');
if (!$con)
{
die('Could not connect: ' . mysql_error($con));
}
mysql_select_db("ooh", $con);
$strSQL="SELECT * FROM files WHERE type = '".$q."' AND price = '".$a."' AND location = '".$b."'";
$rs = mysql_query($strSQL,$con);
while($info = mysql_fetch_array($rs)) {
Print "<div id='filtername' class='fluid'>";
Print "<img src='images/ad_mock4.jpg' alt=''/>";
Print "<div class='box'>";
Print "<h2>".$info['title']. "<h2>";
Print "<p>".$info['shortdescription']. "</p>";
Print "<p class='cat'><strong>Price:</strong>".$info['price'] . "</p>";
Print "<p class='cat'><strong>Duration:</strong>".$info['duration'] . "</p>";
Print "<p class='cat'><strong>Material:</strong>".$info['material'] . "</p>";
Print "<p class='cat'><strong>Type:</strong>".$info['type'] . "</p>";
Print "<p class='cat'><strong>Location:</strong>".$info['location'] . "</p>";
Print "<p class='cat'><strong>Size:</strong>".$info['size'] . "</p>";
Print "</div>";
</div>
Print "<div align='center'><a href='landingpage.php?id=".$info['id']."' class='cssbutton2'>VIEW ITEM</a></div>";
}
mysql_close();
?>