0
所以我有這樣的工作代碼:顯示從PHP所選圖像下拉菜單
<?php
$folder = './images/';
echo '<form action="" method="post">'."\n".'<select name="image">'."\n".
dropdown(image_filenames($folder), @$_POST['image']).
'</select>'."\n".'</form>';
function image_filenames($dir)
{
$handle = @opendir($dir)
or die("I cannot open the directory '<b>$dir</b>' for reading.");
$images = array();
while (false !== ($file = readdir($handle)))
{
if (eregi('\.(jpg|gif|png)$', $file))
{
$images[] = $file;
}
}
closedir($handle);
return $images;
}
function dropdown($options_array, $selected = null)
{
$return = null;
foreach($options_array as $option)
{
$return .= '<option value="'.$option.'"'.
(($option == $selected) ? ' selected="selected"' : null).
'>'.$option.'</option>'."\n";
}
return $return;
}
?>
這是創建一個下拉從我的/ images文件夾中列出的內容菜單。我如何發佈選定的圖片?