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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.