I am currently using this script fragment //using the opendir function to list the files in the directory $dir_handle = opendir("./$localfolder") or die("Unable to open Directory"); //echo "$dir_handle"; //running the while loop while (false !== ($file = readdir($dir_handle))) { //if($file!="." && $file!="..") //backup if($file!="." && $file!=".." && $file!="index.php") { $name=$file; echo $name; echo "<br>"; } } Code (markup): to read the contents of a directory. I would like to populate a dropdown box on an html form with those results so that one item can be selected and submitted. I am assuming that I will need to array them out and then get it to selection portion. Forms are my weakest point. Really could use a little help.
<?php //using the opendir function to list the files in the directory $localfolder = ""; $dir_handle = opendir("./$localfolder") or die("Unable to open Directory"); //echo "$dir_handle"; //running the while loop while (false !== ($file = readdir($dir_handle))) { //if($file!="." && $file!="..") //backup if($file!="." && $file!=".." && $file!="index.php") { $name[]=$file; } } ?> <select name="fileName"> <?php foreach ($name as $filename) { ?> <option value="<?=$filename;?>"><?=$filename;?></option> <?php } ?> </select>