<?
echo '<select name=test>'; //start first list
while($row = mysql_fetch_assoc($result)) //loop through possible values
{
echo "<option value='" .$row['option']. "'>" .$row['option']; //add each option
}
echo '</select>'; //close first list
if (isset($_POST['test'])) //if list had been selected before... build 2nd list
{
$query = "SELECT * FROM ". $_POST['test']; //get 2nd list options
$result = mysql_query($query);
echo '<select name=' .$_POST['test']. '>'; //open 2nd list
while($row=mysql_fetch_assoc($result))
{
echo "<option value='" .$row['option']. "'>" .$row['option']; //add 2nd list options
}
echo '</select>'; //close 2nd list
}
?>
that should be a 2 level example... note, this could be done better to make it infinetly possible... but that would take all the fun out of it if I wrote that 😉
note: this also assumes a table that is named "test" and tables named by the values of the test list, and then tables named after each option under test.... etc, in hindsite selecting 1 table WHERE list=$_POST['test'] would be better....