首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

有关checkbox的有关问题

2012-06-23 
有关checkbox的问题?这样定义两个复选框:input typecheckbox namexuanze[] idxuanze[] value1

有关checkbox的问题?
这样定义两个复选框:
<input type="checkbox" name="xuanze[]" id="xuanze[]" value="1"checked>
<input type="checkbox" name="xuanze[]" id="xuanze[]" value="2"checked>
怎样取得它们的value值?
我试过这种取法:$_POST['xuanze'][0],$_POST['xuanze'][1],结果失败了,请问谁知道怎么取得?

[解决办法]
在此我非常抱歉,那段代码没测试,我有测试了一下,是这样:

PHP code
<?phpif(isset($_POST)){    print_r($_POST);    #Array ( [id] => Array ( [0] => 3 [1] => 4 ) [del] => 删除 )#也就是说,name中[]会被解析为0,1……#$_POST['id'][0] => 3}?><form id="form3" name="form3" method="post" action="test18.php">  <p>  <label for="id2">删除序号为</label>  <input name="id[]" type="text" id="id2" size="10" value="3" />  <input name="id[]" type="text" id="id2" size="10" value="3" />  的记录  </p>  <p>  <input type="submit" name="del" id="del" value="删除" />  </p></form> 

热点排行