I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters what is shown in the dynamic menu.
For example, the first menu has three cities London, Paris, New York. If I choose London it populates the second menu with people from London.
Here is the code I have for my dynamic menu
So basically, I need a standard menu, i.e:
I think I need to hold the value of cities when selected in a variable and create an if statement with various sql query results to be run depending on what option is chosen.
For example, the first menu has three cities London, Paris, New York. If I choose London it populates the second menu with people from London.
Here is the code I have for my dynamic menu
Code:
<td valign=top><strong>Name:</strong></td> <td> <?php echo "<select name=\"name\">"; echo "<option size =30 selected>Select</option>"; if(mysql_num_rows($sql_result)) { while($row = mysql_fetch_assoc($sql_result)) { echo "<option>$row[name]</option>"; } } else { echo "<option>No Names Present</option>"; } ?> </td> </tr>
Code:
<tr> <td valign=top><strong>Sites:</strong></td> <td> <select name="cities"> <option selected>Select</option> <option>London</option> <option>Paris</option> <option>New York</option> </select> </tr> </td>
Comment