I have a script that allows me to fill a form selection box with the contents of a directory. I want this to be possible because many people will be putting files in this directory to be available for distribution. My problem is that when getting the directory listing, I get a response like this.
.
..
document a
document b
etc
So the directory structure itself is showing up in my select box, which allows users to get lost by hitting the submit button while having . or .. selected. Is there any way I can prevent the directoy structures from being shown in my select box?
My php code is as follows:
<?php
function manuals(){
$handle = opendir("./pdfs/");
while ($file = readdir($handle)) {
$files[] = $file;
}
closedir($handle);
foreach ($files as $requests) {
?> <OPTION VALUE="/library/requestforms/pdfs/<?php echo $requests ?> ">
<?php echo $requests ?> </OPTION><?php ;
}
Thanks.