Hello,
I have 2 MySQL tables, 'Main Category', and 'Sub-Category.'
Basically, the Main Category is the main/parent category, and the Sub-Category is a child of the main. In Sub-Category, there's 3 fields, subid, maincatid, and name. What I want is 2 dynamic dropdown menus. The first one, makes a query and gets all the Main Categories AND all the rows. Then, another query is made. The new query gets all the Sub-Categories thats field, 'maincatid' is the chosen one from the first drop-down menu. The second drop-down menu is updated, grabbing all of the correct Sub-Categories. Sorry, I am a bad explainer. If you are confused on what I am saying, please contact me through either this thread, my AIM, or my MSN. (AIM: BAGFULLOFRiCE MSN: lpxxfaintxx@yahoo.com)
Regards,
Help would be GREATLY appreciated.
P.S. This is what I have so far
<select name="category">
<option value="Default">Choose A Category:</option>
<?php $query = "SELECT * FROM category";
$result = mysql_query ($query);
while ($row = mysql_fetch_array
($result, MYSQL_NUM)) {
echo "<option value='{$row[0]}'>{$row[0]}</option>";} ?>
</select></label></td>
</tr>
<tr>
<td align="right" valign="bottom"> </td>
<td><select name="subcategory">
<option value="Default">Choose A Sub-Category:</option>
<?php $query = "SELECT * FROM subcategory WHERE maincatid = 'AHHHH! Help!'";
$result = mysql_query ($query);
while ($row = mysql_fetch_array
($result, MYSQL_NUM)) {
echo "<option value='{$row[0]}'>{$row[0]}</option>";} ?>
</select>