0

So I have a single drop down menu populated from data base, now i want to get a bit snazzy and select from the first and from the selected then populate the 2nd drop down to select and then link to a url.

Here is my code for first drop down which is populating fine, where do i go from here?

$query = "SELECT DISTINCT Manufacturer from manufacturers  ORDER BY Manufacturer ASC";
// Execute it, or return the error message if there's a problem.
$result = mysql_query($query) or die(mysql_error());

$dropdown = "<select name='products'>";

while($row = mysql_fetch_assoc($result)) {

  $dropdown .= "\r\n<option value='{$row['Manufacturer']}'>{$row['Manufacturer']}</option>";

}

$dropdown .= "\r\n</select>";

echo $dropdown;

mysql_close($con);
?>
3
Contributors
5
Replies
19
Views
3 Years
Discussion Span
Last Post by diafol
0

Hi that looks great but the info in the database does change alot

0

So basically you want to populate a second select based on what was selected on the one you posted, correct?

We need a bit more info if that's the case.

  1. Do you want to do this after a reload? The user selects a manufacturer and posts the form in order to create the second select.
  2. Do you already have any data to create the second one? What would the second select take as data to be created, and on which page would it appear, the same or another?
  3. Would you want the second select to be populated asynchronously with AJAX?

Try figuring out what user experience you want and then fill in the gaps for us^^

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.