View Single Post
  #2 (permalink)  
Old 03-05-2007, 06:01 AM
sands's Avatar
sands sands is offline
WebProWorld Veteran
 
Join Date: Sep 2005
Location: Kerala, India
Posts: 395
sands RepRank 1
Default

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 :-)
__________________
My Nook | My Biz | My Photos
Reply With Quote