此代碼是兩個類別和subcategory.In類我顯示在下拉列表中的所有值,但子類別我想說明這是屬於一個類別的準確子類別。請幫我如何顯示屬於某個類別的子類別?
<div class="form-group">
<label for="exampleInputEmail1">Category Name</label>
<select name="type" id="type">
<option>Select Category</option>
<?php
$res= mysql_query("select * from ".CATEGORY." order by id asc");
while($data=mysql_fetch_array($res))
{
?>
<option value="<?php echo $data['id'];?>"><?php echo $data['cat_name'];?></option>
<?php } ?>
</select>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Subcategory Name</label>
<select name="type1" id="type1">
<option>Select Category</option>
<?php $res= mysql_query("select * from ".SUBCATEGORY." order by id asc");
while($data=mysql_fetch_array($res))
{
?>
<option value="<?php echo $data['id'];?>"><?php echo $data['sub_name'];?></option>
<?php } ?>
</select>
</div>
使用AJAX來獲取子類 – Khushboo 2014-10-08 09:28:52