Steve Marquez wrote:
Greetings,
I have some code that opens a directory and displays the files. I want to
display the files in Alphabetical order.
I know this code does not work, but I was curious if someone can take a look
and tell me what is wrong? Thank you so much.
[ I hope the indenting is because you're posting to the list -
tabs/spaces make it a lot easier to follow what's going on ]
You have this:
$file_array = array($file);
sort ($file_array);
foreach($file_array as $key => $value) {
echo "<option value=\"$value\">".$value."</option>";
}
You're "sorting" one element of an array and then printing it out.
Not what you want.
Try this cut down version:
http://pastebin.com/m5bcadd77
Also note that in your example, if a directory can't be opened for
whatever reason, then you don't get a select box at all - is that what
you want to do?
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php