i want to be able to create three combo boxes that are filled dynamically from my tables but each selection box to be "restrained" by the value fo the previous selection.
for examble
combo1 Categories (display all my categories)ok
combo2 Subcategory( display only subcategories of the previous selected category)
combo3 Subsubcategory2(display only subcategories of the previous selected subcategory)
wha i ve done up to now is to greate queries that get my desired vales from my tables but i dont know hoe to restrict those queries dynamically based on the second and third combo box selections
After connecting to my db i use the followinf to create my queries:
Expand|Select|Wrap|Line Numbers
- <?php
- $query = "SELECT mycategories FROM Categories";
- $query2="SELECT mysubcategories FROM Subcategories";
- $result = mysql_query($query) or die(mysql_error());
- $result2 = mysql_query($query2) or die(mysql_error());
Expand|Select|Wrap|Line Numbers
- <?php
- $dropdown = "<select name='category'>";
- while($row = mysql_fetch_assoc($result)) {
- $dropdown .= "\r\n<option value='{$row
- ['category']}'>{$row['category']}</option>";
- }
- $dropdown .= "\r\n</select>";
- echo $dropdown;
- $dropdown2 = "<select name='Subcategory'>";
- while($row = mysql_fetch_assoc($result2)) {
- $dropdown2 .= "\r\n<option value='{$row
- ['subcategory']}'>{$row['subcategory']}</option>";
- }
- $dropdown2 .= "\r\n</select>";
- echo $dropdown2;
- ?>
any tips how to do this????