kat2481 Posted March 14, 2006 Share Posted March 14, 2006 How do I sort this so it displays the results alpha?if ($handle = opendir("/home/mysite/public_html/Store/{$thestore}/Images/")) { //echo "Directory handle: $handle\n"; //echo "Files:\n"; while (false !== ($file = readdir($handle))) { if (strlen($file) >3){ echo "<OPTION Value = '"; echo "Store/{$thestore}/Images/{$file}"; echo "'>"; echo "$file"; echo "</OPTION>"; } } closedir($handle); }if ($handle = opendir("/home/mysite/public_html/Images/Backgrounds/")) { //echo "Directory handle: $handle\n"; //echo "Files:\n"; while (false !== ($file = readdir($handle))) { if (strlen($file) >3){ echo "<OPTION Value = '"; echo "Images/Backgrounds/{$file}"; echo "'>"; echo "$file"; echo "</OPTION>"; } } closedir($handle); }?> --------Thanks for any replies Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted March 15, 2006 Share Posted March 15, 2006 This should help.[code]if ($handle = opendir("/home/mysite/public_html/Store/{$thestore}/Images/")) { while ($file = readdir($handle)) { if (strlen($file) >3){ $files[] = $file; } } closedir($handle); sort($files); foreach ($files as $file) { echo "<OPTION value=\"Store/{$thestore}/Images/{$file}\">$file</OPTION>"; }}if ($handle = opendir("/home/mysite/public_html/Images/Backgrounds/")) { ...same as above...}[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.