当前位置:首页 > CN2资讯 > 正文内容

PHP checkbox全选及提交到PHPphp form

8小时前CN2资讯


<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script> function checkAll(obj,names){ var checkboxs = document.getElementsByName(names); for(var i=0;i<checkboxs.length;i++){checkboxs[i].checked = obj.checked;} } </script> </head> <body> <form id="form1" name="form1" method="post" action="manage.php"> <table width="100%"> <tr> <td> <input type="checkbox" name="checkbox[]" value="a" />甲类 <input type="checkbox" name="checkbox[]" value="b" />乙类 <input type="checkbox" name="checkbox[]" value="c" />丙类 </td> </tr> <tr> <td><input type="checkbox" name="pointall" οnclick="checkAll(this,'checkbox[]')" />全选/取消</td> </tr> <tr> <td><input type="submit" name="Submit" value="提交" /></td> </tr> </table> </form> </body> </html>

效果图:


 

<?php print_r($_POST[checkbox]); ?>

效果图:


 

PS:兼容IE6+,火狐 ,谷歌,欧朋

 

 

 

 

 

 

 

 

 

 

    你可能想看:

    扫描二维码推送至手机访问。

    版权声明:本文由皇冠云发布,如需转载请注明出处。

    本文链接:https://www.idchg.com/info/26284.html

    分享给朋友:

    “PHP checkbox全选及提交到PHPphp form” 的相关文章