Forum Moderators: coopster
Im using the code below to autofill a dropdown list from my MYSQL DB.
The only problem is it is leaving out the first entry (alphabetically) for each $vehicle_make?
Does anyone know why this may be hapenning?
[PHP]<select name="vehicle_model" class="textbox">
<option value="">select a type</option>
<?php
require_once ('../mysql_connect.php');
$query = mysql_query("SELECT model FROM Vehicles WHERE make='$_GET[vehicle_make]' ORDER BY model"); // autofill dropdown list 'select' with options from DB
$r = mysql_fetch_array($query);
while($r = mysql_fetch_assoc($query)) {
echo '<option value="'.$r['model'].'">'.$r['model'].'</option>';
}
?>
</select>[/PHP]
[PHP]make='$_GET[vehicle_make]'[/PHP] An example of this data is (Honda, Ford, Toyota)