finding folders.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nemode
Forum Newbie
Posts: 12
Joined: Sat Nov 01, 2003 11:20 am

finding folders.

Post by nemode »

is there a way to find all the folders in a directory and then have them placed into a dropdown box????

although ok at php. this is what i thought of. doesn work though. :S

<select name='folder' class='dropdown'>
<?php
$handle = @opendir( '../folders/' );
$matches = array();
if ( $handle != '' ) {
while ( $file = readdir($handle)) {
$matches[] = $file;
}
}
for($i = 0, $j = count($matches); $i < $j; $i++) {
echo "<option value='", $matches[$i] ;
echo "'></option>";
}

?>
</select>
anyone have any ideas?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

i have been looking for the same thing, and found this just then :

http://www.g2k.dk/stuff/txt/directory/

http://www.computing.net/programming/ww ... /8345.html

you may be able to use this function to do just what you need. I know it's gonna work for me (having to wait at school for my class to begin/end before i can get home and try it out to be sure though..).
Post Reply