listing folders one level up in a select value
Posted: Tue Feb 06, 2007 2:31 pm
hey guys this is kind of an extension to what i submitted before. Am confused why this doesnt work.
The code below is ripped and edited from my last problem which was solved using a variant of this.
what I want it to do is check for files and see if they are directories, then only show the directories in the select list. unfortunately this seems to be showing nothing. If I stick a ! infront of the is_dir it decides to show everything all the directories and files
thanks
Andy
The code below is ripped and edited from my last problem which was solved using a variant of this.
Code: Select all
printdir('/*');
function printdir($path) {
echo "<select name=selection>";
foreach( glob($path.'/*') as $e ) {
if ( is_dir(basename($e)) ) {
echo "<option value=\"$e\">", basename($e), "- $e</option><br />";//displays file and path
}
}
echo "</select>";
}thanks
Andy