I have successfully created a dynamic drop down menu using the following code and it works fine:
$query = "SELECT * FROM name";
$result = mysql_query($query);
while ($record = mysql_fetch_assoc($result)) {
echo "<OPTION VALUE = '".$record["staffID"]."'>".$record["surname"].', '.$record["forename"];
}
However, I want the records returned to be in alphabetical order in relation to "surname". I think I need to use the sort function but all attempts have failed.
If anyone has the answer I would be very grateful.
Sort function - drop down menu
Moderator: General Moderators