问题解决了我的问题是我键入我的动态选择退出形式,只是回应它,当我调用它只是第一个选项值发送到我的代码我改变我的代码和工作正常,如果你喜欢你可以使用我的代码很好,如果你想通过动态输入选择显示和过滤列表的选择数据类别,我的代码工作正常。
动态选择表单数据库:
<?php
$select_status_2 = "<select name='status1'>\n";
$select_status_2 .= "<option value=''>ALL</option>\n";
$dataset_2 = mysql_query("SELECT DISTINCT subcategory FROM products ORDER BY subcategory ASC");
while($row=mysql_fetch_array($dataset_2)) {
$select_status_2 .= "<option value='".$row['subcategory']."'";
if (strtolower($row['subcategory']) == strtolower($select_status_2)) {
$select_status_2 .= " selected='selected'>".$row['subcategory']."</option>\n";
} else {
$select_status_2 .= ">".$row['subcategory']."</option>\n";
}
}
$select_status_2 .= "</select>\n";
?>
此部分用于显示我的动态选择和提交按钮:
<form action="inventory.php" enctype="multipart/form-data" name="sortlist" id="myform" method="post">
<table width="90%" align="center" border="1" cellspacing="0" cellpadding="6" style="text-align:center;">
<tr>
<td align="left"><?php echo $select_status?></td>
<td align="left"><?php echo $select_status_2?></select></td>
<td colspan="3" width="50%"> </td>
<td><input type="submit" name="button2" id="button3" value="مرتب سازی"></td>
</tr>
<tr>
<td colspan="7"><?php echo $dyn_table; ?></td>
</tr>
</table>
</form>
此部分用于过滤我的查询
<?php
$status= $_POST['status'];
$status1= $_POST['status1'];
if(!isset($_POST['state']))
{
$sql= mysql_query("SELECT * FROM products");
}
else{
if($_POST['state']){
$status= $_POST['status'];
$status1= $_POST['status1'];
if($status1=="ALL"||$status=="ALL")
$sql= mysql_query("SELECT * FROM products");
}
else
{
if($status1=="ALL")
$sql= mysql_query("SELECT * FROM products WHERE category='status'");
}
}
?>