21,886
社区成员
发帖
与我相关
我的任务
分享
<?php
function generate_checkboxes($name,$options,$default=NULL)
{
if (!is_array($default))
{
$default = array();
}
foreach($options as $value =>$label)
{
$html .="<input type=\"checkbox\"";
if (in_array($value,$default))
{
$html .="checkbox";
}
$html.="name=\"{$name}[]\"value=\"$value\">";
$html.=$label ."<br>";
}
return($html);
}
$options = file("test.txt");
$html = generate_checkboxes("interests",$options,$intrests);
?>
黑名单:
<hr />
<form action="22.php" method="post">
<?php echo $html;?>
<hr />
<input type="submit" value="提交" />
<input type="reset" value="取消" />
</form>