html:
1
2
3
4
5
6
7
8
|
<
form
id
=
"form1"
name
=
"form1"
method
=
"post"
action
=
"checkbox.php"
>
<
input
type
=
checkbox
name
=
checkbox
[]
value
=
"1"
>
<
input
type
=
checkbox
name
=
checkbox
[]
value
=
"2"
>
<
input
type
=
checkbox
name
=
checkbox
[]
value
=
"3"
>
<
input
type
=
checkbox
name
=
checkbox
[]
value
=
"4"
>
<
input
type
=
checkbox
name
=
checkbox
[]
value
=
"5"
>
<
input
type
=
"submit"
name
=
"button"
id
=
"checkbox"
value
=
"提交"
/>
</
form
>
|
php:
1
2
3
4
5
6
7
8
|
<?php
$text1
=
$_POST
[
'checkbox'
];
for
(
$i
=0;
$i
<
count
(
$text1
);
$i
++)
{
$yourwant
=
$text1
[
$i
];
echo
$yourwant
.
"<br/>"
;
}
?>
|