php简单获取复选框值的方法

Original 2017-01-05 14:29:10 229
abstract:本文实例讲述了php简单获取复选框值的方法。分享给大家供大家参考,具体如下:html:<form id="form1" name="form1" method="post" action="checkbox.php"> <input type=chec

本文实例讲述了php简单获取复选框值的方法。分享给大家供大家参考,具体如下:

html:

<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:

<?php
$text1=$_POST['checkbox'];
for($i=0;$i<count($text1);$i++)
{
$yourwant = $text1[$i];
echo $yourwant."<br/>";
}
?>

 更多关于php简单获取复选框值的方法请关注PHP中文网(m.sbmmt.com)其他文章!  


Release Notes

Popular Entries