php中带有单选按钮的图像(无数据库)
|
我正在尝试创建一个简单的动态图库,并在每个图像下方带有一个单选按钮,以允许用户选择图像并提交表单。我还不关心处理表单,我只想弄清楚如何动态生成表单。目前,我正在以此创建图库;
<?php
$images = \"image_gallery/\";
$big = \"big/\";
$cols = 2;
if ($handle = opendir($images)) {
while (false !== ($file = readdir($handle))) {
if ($file != \".\" && $file != \"..\" && $file != rtrim($big,\"/\")) {
$files[] = $file;
}
}
closedir($handle);
}
$colCtr = 0;
echo \'<table width=\"100%\" cellspacing=\"3\"><tr>\';
foreach($files as $file)
{
if($colCtr %$cols == 0)
echo \'</tr><tr><td colspan=\"2\"><hr /></td></tr><tr>\';
echo \'<td align=\"center\"><a href=\"\' . $images . $big . $file . \'\"><img src=\"\' . $images . $file . \'\" /></a></td>\';
$colCtr++;
}
echo \'</table>\' . \"\\r\\n\";
?>
似乎我应该在foreach循环中创建单选按钮,但是我不确定确切的位置或方式。
感谢您的帮助。
没有找到相关结果
已邀请:
1 个回复
橙绥