Is there a way i can get a dropdown box to automatically list the file names of a folder?
I have an avatars folder and to save me making mistakes typing the name i want i want to just select from a dd box.
Drop down
Started by Bl4ck-Vip3r, Apr 01 2007 05:27 AM
2 replies to this topic
#1
Posted 01 April 2007 - 05:27 AM
#2
Posted 01 April 2007 - 05:47 AM
put
change $path ofcourse
<select name='file'>
<?
//define the path as relative
$path = "changeme";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
//running the while loop
while ($file = readdir($dir_handle))
{
if($file!="." && $file!="..")
echo "<option value='$file'>$file</option>";
}
//closing the directory
closedir($dir_handle);
?>
</select>
change $path ofcourse
Edited by curthard89, 01 April 2007 - 05:49 AM.
#3
Posted 01 April 2007 - 06:36 AM
Thanks man you been a great help!!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
