-
Hi,
I've got a little problem. I want to list a dir with images. How do I put the whole dir in a while?
In fact I want to create an option list with all images. like this:
<select>
<option value="some_image.jpg">some_image.jpg</a>
<option value="some_image2.jpg">some_image2.jpg</option>
</select>
do you understand? yes?
oh great, and how do I do this? :D
-
I would first loop through the folder and place all the filenames in an array, then I wouls simply loop through the array and put each filename into the drop down list
PHP Code:
<?
$dir = dir("/path/to/images/folder");
while($file = $dir->read()) {
if (($file != ".") && ($file != "..")) {
$files[] = $file;
}
}
?>
<select name="images">
<?
foreach($files as $key => $val) {
?>
<option value="<?=$val?>"><?=$val?></option>
<?
}
?>
</select>
-