Jump to content

[SOLVED] Dynamic drop down menu but with an item always listed first


Eiolon

Recommended Posts

I have a dynamic drop down menu that is pull categories from a database.  I have everything listed in alphabetical order however, I want one item to always be listed as the first thing in the box even though its not at the beginning of the alphabet.

 

$query_categories = "SELECT * FROM categories ORDER BY category ASC";
$categories = mysql_query($query_categories) OR die ('Cannot retrieve a list of categories.');

<select name="category" id="category" style="width:250px">
  <?php
    while($row_categories = mysql_fetch_array($categories)) {
      print '<option value="' . $row_categories['category_id'] . '">' . $row_categories['category'] . '</option>';
    }
  ?>
                                </select>

 

That's the code I have now.  Not sure what to do about the moving of the item to the top.  Thanks for your help!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.