Good day to you all,
In the following code it’s a form and within this form user can choose an image from a selection box. Beside the selection box there is an images that is “supposed” to change by the choice they make in the selection box.
When you change the selection in the selection box, the image goes blanck, it can find it, I’m sure I have done an erore somewhere can somebody help me with this please ?
I’m with php4 and windows 2003.
here is the code :
[code=php]
<?PHP
function PGL_ConfigList($dir)
{
$pattern=”.(jpg|jpeg|png|gif|bmp)$”;
$files = array();
if($open = opendir($dir))
{
while(false !== ($file = readdir($open)))
{
if(eregi($pattern, $file) && !is_dir($file))
{
$files[] = $file;
}
}
}
closedir($open);
return($files);
}
$dir = “./upload/”;
$list = PGL_ConfigList($dir);
echo “<select name=”image” onchange=”noimage.src=’$file'”>”;
foreach($list AS $file)
{
echo “<option value=”$file”>$file</option>”;
}
echo “</select>”;
?>
<br>
<img src=”upload/peuplies-1-man-small.bmp” width=”200″ name=”noimage”>
<br>
<input type=”submit” name=”submit” value=”Submit”>
</form>
</fieldset>
</td>
</tr>
</table>
</body>
</html>