I need to make a dropdown menu that includes options from the database, and pre-existing options. The options need to all be in alphabetical order. However current records in the database don't have these options yet, so I can't just pull them all from the database.
Code: Select all
echo "<select name=\"vendortype\">
<option value=\"$vendortype\">$vendortype</option>
<option value=\"$vendortype\">--------------</option>
<option value=\"Hauler\">Hauler</option>
<option value=\"Single Source Recycle\">Single Source Recycle</option>
<option value=\"Multi Source Recycle\">Multi Source Recycle</option>
<option value=\"Broker\">Broker</option>
<option value=\"Management Co\">Management Co</option>";
// Look for options that were added later
$query_0 = "select distinct vendortype as something from Vendors where vendortype != 'Hauler' and vendortype != 'Single Source Recycle' and vendortype != 'Multi Source Recycle' and vendortype != 'Broker' and vendortype != 'Management Co' and vendortype != '' order by vendortype asc;";
$result_0 = mysql_query($query_0);
while($fetch_0 = mysql_fetch_array($result_0))
{
extract($fetch_0);
echo "<option value=\"$something\">$something</option>";
}
echo "</select>";Point is, I need both pre-existing and database created options to display in alphabetical order together.
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: