把表单设定成:
<form action="shit.php" method="POST">
1<input type="checkbox" name="num[]" value=1>
2<input type="checkbox" name="num[]" value=2>
...
</form>
#shit.php
<?
for($i=0;$i<count($num);$i++)
echo($num[$i]."
n");
?>
你就会看到:
1
2
3
...
其实只要把表单里的name写成var[]或者var[var],PHP就会自动放到一个数组了的了。
multi select也可以这么干,把name写成name=var[]就可以了
|