我想在网页上显示一个基于类别的购物项目,其中包含可以在大多数在线购物网站中找到的图像。我创建了两个mysql 表:带有 id 、 category_name 的 Ist和带有 id、categoryid、product、image_path的第二个表。我可以在页面上一次显示所有产品图片,但我不知道如何显示从下拉列表中选择的单个类别的产品图片,页面顶部带有提交按钮。我希望我的观点对所有人都很清楚,否则请随时问我。
下面我附上了我的代码,它一次显示我的 php 页面上的所有产品图像,没有任何下拉列表。欢迎对此提出任何想法和建议。
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
ul, li {
list-style-type:none;
}
ul.display {
width: 500px;
}
ul.display li {
float: left;
width: 100px;
height: 120px;
margin-left: 5px;
margin-right: 5px;
margin-bottom: 5px;
position: relative;
vertical-align:middle;
text-align:center;
}
ul.display li a img {
width: 94px;
height: 114px;
display: inline;
}
</style>
</head>
<body>
<div align="center">
<?php
include('connect.php');
$SQL = "SELECT * from becuart";
$result = mysql_query( $SQL );
echo "<ul class='display'>";
while( $row = mysql_fetch_array( $result ) ) {
$filepath = $row["path"];
echo "<li>";
echo "<a href=\"$filepath\"><img src=\"$filepath\" border=\"0\"></a>";
echo "</li>";
}
echo "</ul>";
?>
</div>
</body>
</html>`