on 02/01/03 9:36 AM, Alexander Guevara ([EMAIL PROTECTED]) wrote: > i need to get in a select box all the dirs inside a folder.. how can i do > that?
Give this a whirl. Please note, this code is very much slapped together... it works, and i've tested it, but there's nearly ZERO error checking. <? // a function for your library function getFilesInDir($thedir) { chdir($thedir); $dir = opendir('.'); while (($myfile = readdir($dir)) !==false) { if ($myfile != '.' && $myfile != '..' && is_file($myfile) ) { $files[] = $myfile; } } closedir($dir); chdir('../'); return $files; } // get the files in an array $files = getFilesInDir('../preshrunk/inc/'); // spit out a select box echo "<form><select name='files'>"; foreach($files as $key => $value) { echo "<option value='{$value}'>{$value}</option>"; } echo "</select></form>"; ?> Cheers, Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php