简体   繁体   English

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

[英]PHP SQL Drop Down List — Displays but Can't Select

I'm trying to create a drop down menu that dynamically updates a table. 我正在尝试创建一个下拉菜单来动态更新表格。 The drop down list shows the items in the category table, but they are not clickable--they can't be selected. 下拉列表显示了类别表中的项目,但它们不可单击-无法选择。 What am I doing incorrectly? 我做错了什么?

    $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>

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

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

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

Try building in php as shown above. 尝试如上所述构建PHP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM