Peuplarchie Posted December 8, 2009 Share Posted December 8, 2009 Good day to you all, here i'm working on a snippet that list the folder in a folder and return is content to a combo box. My problem is it don't sort. Here is my code: <?PHP $console = $_GET['console']; $dir = "Names/"; echo "<select name=\"cars\">"; // Open a known directory, and proceed to read its contents $dir_handle = @opendir($dir) or die("Unable to open $dir"); while($file = readdir($dir_handle)) { sort($file); if(is_dir($file)) { if($file != '.' && $file != '..') { } } else if($file != '.' && $file != '..') { $filing = sort($file); echo "<option value=\"".$path/$filing."\">".$file."</option>"; } } ?> </select> Thanks ! Quote Link to comment https://forums.phpfreaks.com/topic/184341-list-soted-folder-in-combo-box/ 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.