Here is my problem. I have a form of update, and would like to display the names of the images contained in a folder all in a listbox. That way I could select the image I want through the listbox and do a little update. But as my knowledge is concerned, php is quite limited (sql insert, update and delete). So how can I display a listbox inside a directory?
PHP Code:
<select name="listDir">
<?php
$rep ='upload/';
if (!is_dir ($rep)) {
echo 'Error, ', $dir,' is not a valid directory';
exit;
}
$dir = opendir ($rep);
while (false !== ($file = readdir ($dir))) {
if ($file !== '..' && $file !== '.') {
echo '<option value="',$file,'">',$file,'</option>';
}
}
?>
</select>
Bookmarks