<form name="myform" action="index2.php" method="post">
兴趣爱好
<input type="checkbox" name="v[]" value="阅读"/>阅读
<input type="checkbox" name="v[]" value="篮球"/>篮球
<input type="checkbox" name="v[]" value="旅游"/>旅游
<input type="submit" value="提交" />
</form>
PHP页面:
$result = "";
foreach( $_POST[‘v‘] as $i)
{
echo ‘<br>‘;
$result .= $i;
}
echo $result;
注意:name="v[]";
时间: 2024-10-13 10:21:58