Hi. Being a beginner in Dynamic Web Site development, I am rather frusterated that the following bit of code doesn't seem to do anything at all
<select name="picture" id="picture">
<option value="">Select an image</option>
<?php
// execute code if images folder can be opened
if ($imageFolder = @opendir("../images/")) {
// create an array for image types
$imageTypes = array('jpg','jpeg','gif','png');
// traverse folder, add filename to $img array if image
while (($imageFile = readdir($imageFolder)) !== false) {
$fileInfo = pathinfo($imageFile);
if (in_array($fileInfo['extension'],$imageTypes)) {
$img[] = $imageFile;
}
}
// close the stream to images folder
closedir($imageFolder);
// check that $img array is not empty
if ($img) {
// populate menu
foreach ($img as $image) {
echo "<option value='$image'>$image</option>\n";
}
}
}
?>
</select>
This code (whici is taken from the book "PHP Web Development with Macromedia Dreamweaver 2004" and is supposed to populate the dropdown menu "image"
PLEASE, HELP AS I AM GETTING DESPERATE