Try this:
Code:
<select name="file">
<option value='empty'>Select a file</option>
<?php
$dirname = "folder/";
$dh = opendir($dirname);
$count = 0;
while ($file = readdir($dh)) {
if (substr($file, -4) == ".txt") {
$count++;
print "<option value='$dirname$file'>File $count</option>\n"; }
}
closedir($dh);
?>
</select>
Did not have time to check it out. But it should work. If not, dabble with it till it does :-)