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);
?>

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

anything else somebody can offer please?

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^^

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.