【发布时间】:2020-02-06 12:25:14
【问题描述】:
我的问题是,我希望我的输出以
下拉列表(树视图结构)的形式显示在 select 标记 中,而且我也想要选择多个类别
借助使用 html 标签,即 Checkbox。
<?php
function getCategory($parent_id){
$con = connect_db();
$sql = "select ocd.category_id,ocd.name, occ.parent_id from oc_category_description ocd, oc_category occ where ocd.category_id=occ.category_id and parent_id='".$parent_id."' ORDER BY name";
$result = mysqli_query($con,$sql);
if (mysqli_num_rows($result) > 0)
{
echo "<ul>";
while ($row = mysqli_fetch_object($result))
{
echo "<li>".$row->name.'('.$row->category_id.')'."</li>";
getCategory($row->category_id);
}
echo "</ul>";
}
}
$parent_id = 0;
getCategory($parent_id);
?>
这里的输出:- enter link description here
【问题讨论】:
标签: javascript php html css mysql