PHP SQL下拉列表 - 显示但无法选择

时间:2012-12-11 08:34:42

标签: php html-select

我正在尝试创建一个动态更新表格的下拉菜单。下拉列表显示类别表中的项目,但它们不可单击 - 无法选择它们。我做错了什么?

    $sql = "SELECT pd_id, c.cat_id, cat_name, pd_name, pd_thumbnail
        FROM tbl_product p, tbl_category c
        WHERE p.cat_id = c.cat_id $sql2
        ORDER BY pd_name";
$result     = dbQuery(getPagingQuery($sql, $rowsPerPage));
$pagingLink = getPagingLink($sql, $rowsPerPage, $queryString);

$categoryList = buildCategoryOptions($catId);

?> 
<p>&nbsp;</p>
<form action="processProduct.php?action=addProduct" method="post"  name="frmListProduct" id="frmListProduct">
 <table width="100%" border="0" cellspacing="0" cellpadding="2" class="text">
  <tr>
   <td align="right">View products in : 
    <select name="cboCategory" class="box" id="cboCategory" onChange="viewProduct();">
     <option selected>All Category</option>
    <?php echo $categoryList; ?>
   </select>
 </td>
 </tr>
</table>

1 个答案:

答案 0 :(得分:0)

foreach ( $query->result_array () as $val ) {

`$cat=$val['categoryid'];`

echo "<OPTION value=\"$cat\">$cat</OPTION>"; }

尝试在php中构建,如上所示。