Alphabetizing dropdown list
Posted: Wed Nov 06, 2002 12:06 pm
I have this dropdown list as part of a form that inserts/updates to the MySQL database:
http://www.npiflorida.com/admin/chapter ... member.php
I'm trying to alphabetize the list and have a selected one showing first, here is the code I'm using. Would I have to retrieve the list into and array to sort it?:
http://www.npiflorida.com/admin/chapter ... member.php
I'm trying to alphabetize the list and have a selected one showing first, here is the code I'm using. Would I have to retrieve the list into and array to sort it?:
Code: Select all
<?
include('dbconnect.php');
include('font_setting2.htm');
$query = ("select * from tbl_chapter");
$result = mysql_query($query) or die("Query fail");
if (mysql_num_rows($result) == 0)
{
} else
{
//echo "<B> Current Chapters List </B>";
echo "<select name='chapter'>";
echo "<option>" . "$chapter_name" . "</option>";
while($row = mysql_fetch_array($result))
{
$chapter_name = $rowї'chapter_name'];
echo "<option>" . "$chapter_name" . "</option>";
}
}
include ('chapter_for_delete2.php');
?>