Hi, noob in need of assistance..
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:
and whwere i want the combobox to appear i use the follwong to create and populate them
i tried saving $dropdown on a variable in order to use it as a condition in my 2nd and 3rd query( where subcategory_par ent=category) but with no luck
any tips how to do this????
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:
Code:
<?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());
Code:
<?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????