我有这个搜索功能与类别,当你点击这个类别,你将在该类别内搜索,但我想使它,使我能够在多个类别内搜索关键字。这是我的表格:
<form method="get" action="zoek.php">
<input type="text" name="producttitle" placeholder="Productnaam">
<input type="hidden" name="prodgroup" value="<?= (isset($_GET['prodgroup'])) ? $_GET['prodgroup'] : '' ?>">
<input type=submit class="btn btn-primary" value="Zoek...">
</form>
这是您单击类别并搜索单词的代码
<?php
if (isset($_GET['prodgroup']) && $_GET['prodgroup'] != "" && isset($_GET['producttitle']) && $_GET['producttitle'] != "") {
$category = $_GET['prodgroup'];
$prodtit = $_GET['producttitle'];
$query = $readconn->prepare("
SELECT S.StockItemID, S.StockItemName, S.Photo, S.UnitPrice, S.Photo, S.Brand
FROM stockitems S JOIN stockitemstockgroups SISG ON S.StockItemID = SISG.StockItemID
JOIN stockgroups SG ON SISG.StockGroupID = SG.StockGroupID
WHERE SG.StockGroupID = '" . $category . "'
AND S.StockItemName LIKE '%" . $prodtit . "%'
");
以下是带有id的类别: `.
49条答案
按热度按时间taor4pac31#
---+
mftmpeh832#
----+
hwazgwia33#
-: | 1 | Novelty Items | :
vfwfrxfs34#
----: | 9 | 9 | :
cbeh67ev35#
-: | 6 | Computing Novelties | :
ncgqoxb036#
-: | 8 | Furry Footwear | :
8ulbf1ek37#
----+
yshpjwxd38#
---+
rn0zuynd39#
----+
vawmfj5a40#
----: | 8 | 7 | :
b4lqfgs441#
-: | 9 | Toys | :
k5ifujac42#
-: | 3 | Mugs | :
mbskvtky43#
-: | 10 | Packaging Materials | '
axzmvihb44#
----: | 7 | 8 | :
r9f1avp545#
----+