Thank you to all who can shed some light.
SilvrWolf
Code: Select all
<?php
//Insurance Image
//ins_image_array gets an array of images from the image directory
$path = "../images/";
if ($dir = opendir($path)) {
while($file = readdir($dir)) {
if ($file != "." && $file != ".." && substr($file, -3) == "gif" || substr($file, -3) =="jpg"){
$ins_image_array[] = $file;
}
}
closedir($dir);
}
// create a drop-down with the file names in the image directory
// use the image_dir_arry to populate the drop down
// use logic to select the image file name and place SELECTED in its option tag
for ($i=0; $i<count($ins_image_array)-1; $i++){
echo "<option value="".$ins_image_array[$i].""";
if ($ins_image_array[$i]=="no_image.gif"){
echo "SELECTED";
}
echo ">".substr($ins_image_array[$i], 0, -4)."</option>\n";
}
?>