PHP/MYSQLこのHTMLは、上記の二つのテーブル[Category]
と[SubCategory]
最初のドロップダウンに基づいてドロップダウンの値を取得するには、必要
PHPですべてのカテゴリとサブカテゴリを取得
<div style="width:810px; margin:inherit; padding-left:170px;">
<select style="width:300px;" id="n" name="userListingCateory">
<option disabled="disabled">Category...</option>
<?php while($row = $sth2->fetch(PDO::FETCH_ASSOC))
{echo "<option value=". $row['catID'] . ">" .$row['catName']."</option>";}
unset($sth2);
?>
</select>
<select style="width:340px;" id="n" name="userListingSubCateory">
<option disabled="disabled">Sub-Category...</option>
<?php while($row = $sth3->fetch(PDO::FETCH_ASSOC))
{echo "<option value=". $row['scatID'] . ">" .$row['scatName']."</option>";}
unset($sth3);
?>
</div>
</select>
/MySQLを選択しました[Category]
のプルダウンをクリックして実行すると、次のようになります。
SELECT scatID, scatName
FROM Category C, SubCategory SC
WHERE C.catID = SC.catID
AND C.catID = $origCatIDSelected;
が選ばれたことに基づいて、sub-categories
を取得するにはどうすればよいですか?
jquery/phpに実装する簡単な方法はありますか?
おかげ
これが必要です:http://stackoverflow.com/a/7137507/762449 – AlphaMale