您好,欢迎访问一九零五行业门户网

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/>";}?>
预定义的 $_post 变量用于收集来自 method=post 的表单中的值。
从带有 post 方法的表单发送的信息,对任何人都是不可见的(不会显示在浏览器的地址栏),并且对发送信息的量也没有限制。
推荐:php服务器
以上就是php如何获取复选框的值的详细内容。
其它类似信息

推荐信息