php checkbox 取值实例教程
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <body> html复选框如果要以数据组形式发送给php脚本处理就必须以如checkbox[]这形式 <form id="form1" name="form1" method="post" action=""> <label> <input type="checkbox" name="checkbox[]" value="1" /> </label> <label> <input type="checkbox" name="checkbox[]" value="2" /> </label> <label> <input type="checkbox" name="checkbox[]" value="www.phprm.com" /> </label> <label> <input type="checkbox" name="checkbox[]" value="phprm.com" /> </label> <label> <input type="submit" name="Submit" value="提交" /> </label> </form> </body> </html> <? //判断是否点击提交 if( $_POST ) { $array = $_POST['checkbox']; print_r($array); } /* 结果: Array ( [0] => 1 [1] => 2 [2] => www.phprm.com [3] => phprm.com ) 简单的很多事情在做之前觉得复杂但做起来就很容易了,像这个复选框代码就是这样了。 */
教程网址:http://www.phprm.com/code/php-checkbox-111cn-ne.html
欢迎收藏∩_∩但请保留本文链接。