这篇文章主要介绍了php简单获取复选框值的方法,简单分析了php以数组形式传递复选框checkbox值的实现方法,需要的朋友可以参考下
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免费学习笔记(深入)”;











