Jump to content

Sorting Tags Alphabetically


tahirk

Recommended Posts

I'm having a tags group from where we can select different number of tags. Currently, these tags are being displayed in order in which they are input. I want these to be displayed in an alphabetical order.

 

Here is the php code for the part (ta_name is what I want this to sort to):

<div class="control-group">
    <label class="control-label" for="qu_tags[]"><?php echo lang("input_tags"); ?></label>
    <div class="controls">                            
        <select id="qu_tags" name="qu_tags[]" size="10" multiple="multiple">
            <option value="">- Choose Tags</option>                        
            <?php foreach ($tags as $ta) { ?>
                <option value="<?php echo $ta["_taid"]; ?>" <?php echo set_select('qu_tags[]', $ta["_taid"]); ?>><?php echo $ta["ta_name"]; ?></option>
            <?php } ?>                                              
        </select>
        <span class="help-inline error"><?php echo form_error("qu_tags[]"); ?></span>     
    </div>
</div>

Can you please help me in here to display them in an alphabetical order regardless of the way they are input.

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.