<?php $dir = '/home/....'; $files = scandir($dir); foreach ($files as &$file) { if ($file!='.' && $file!='..' ) { ?> <select name="main"> <option value =""><?=$file?></option> </select> <? } } ?> Code (markup): that selects the folders in the directory,but that makes a dropdown menu for each folders name. i'm looking for all the folder names to be in one dropdown menu.
Try this: <?php $dir = '/home/....'; $files = scandir($dir); print '<select name="main">'; foreach ($files as &$file) { if ($file!='.' && $file!='..' ) { ?> <option value =""><?=$file?></option> <? } } print '</select>'; ?> Code (markup):