ok i want to put the results from a query into a drop down list:
my code so far:
<select name="aircraft">
<?php
include "config.php3";
include "dbconnect.php3";
$q = "SELECT Reg AS reg, Type AS type FROM $table4 GROUP BY Type";
$result = mysql_query($q)or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
$reg = $row["reg"];
$type = $row["type"];
$options .= "<optgroup label=\"$type\"><option value=\"$reg\">$reg</option>";
echo $options;
}
?>
</optgroup>
</select>
there are 6 rows in the database, its pulling all 6 and sticking the type for each aircraft seperatly with the reg of the first row of that aircraft
where as i want it to put all reg's from the type or aircraft in each aircraft group
i cant work out how to do that though?