we have a directory with pics, that a user can associate with his data in a
form. we use opendir/readdir to show the directory contents. unfortunately,
this is not sorted. How can we achieve a listing in alphabetical order?

this is our code:

echo "<select name='image'>";
echo "<option value=''>please select</option>";
$fp = opendir("../pics/");
        while ($file = readdir($fp)) { 
                if ($file=="." OR $file=="..") { } else {
                $string_image .= "<option value='/pics/".$file."'";
                if ($selectfile==$image) { $string_image .= " SELECTED"; }
                $string_image .= ">".$file."</option>";
echo $string_image;
echo "</select>"; 

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to