ผมไม่รู้ว่าคุณแยก sub ยังไง
เลยคิดเอาเองน่ะว่าใช้ field แยก sub
สมมติมี field id, type_car,ban_car,color_car
Code (PHP)
$type="select * from tbl_car group by type_car";
$result=mysql_query($type);
echo "<select name=\"sel_car\">";
while($rs=mysql_fetch_array($result)){
echo "<option disabled>$rs[type_car]</option>";
$ban ="select * from tbl_car where type_car='$rs[type_car]' group by ban_car";
$result2=mysql_query($ban);
while($rs2=mysql_fetch_array($result2)){
echo "<option disabled>->$rs2[ban_car]</option>";
$color ="select * from tbl_car where type_car='$rs[type_car]' and ban_car='$rs2[ban_car]' group by color_car";
$result3=mysql_query($color);
while($rs3=mysql_fetch_array($result3)){
echo "<option value=\"$rs3[id]\">->->$rs3[color_car]</option>";
}
}
}
echo "</select>";