使用php怎么获取复选框的值
本篇文章为大家展示了使用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怎么获取复选框的值,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注行业资讯频道。