JNL JNL - 1 year ago 108
PHP Question

PHP array sort / select option form

I have a form in PHP. It is unsorted. I would like to sort it. How would I go by it. This is the following PHP code I have. Thanks for help in advance.

<select id="school_name" name="school_name">
<option value="">Select School</option>
<?php for($c=0; $c<sizeof($school_details); $c++){?>
<option value="<?php echo stripslashes($school_details[$c]["title"]); ?>"
<?php if($school_details[$c]["title"]==$appInfo["school_name"]){?> selected="selected" <?php } ?> ><?php echo stripslashes($school_details[$c]["title"]); ?>
<?php } ?>

Answer Source

PHP provides a number of methods for sorting: http://www.php.net/manual/en/array.sorting.php

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download