如何不用javascript如何获取多选框的 多个值 $post ???我知道是$_post['']获取但是我要获取的是表单 多选框多个值啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <form id="form1" name="form1" method="post" action=""> <label> <input type="checkbox" name="checkbox" value="game" /> 游戏 <input name="checkbox" type="checkbox" id="checkbox" value="movie" /> 电影 <input name="checkbox" type="checkbox" id="checkbox" value="music" /> 音乐</label> <input type="submit" name="Submit" value="提交" /></form><?phpif ($_POST['checkbox']!=""){$box=$_POST['checkbox'];echo $box;}?> 用数组来传递:<input type="checkbox" name="Name[]" value="Value_1" />...<input type="checkbox" name="Name[]" value="Value_n" />$chk = $_POST["Name"]; //$chk是一个数组 <?phpif ($_POST['checkbox']!=""){ $box=$_POST['checkbox'];foreach ($box as $value){ echo $value; }}?>是这样吗 出错了啊 <form id="form1" name="form1" method="post" action=""> <label> <input type="checkbox" name="checkbox[]" value="game" /> 游戏 <input name="checkbox[]" type="checkbox" id="checkbox" value="movie" /> 电影 <input name="checkbox[]" type="checkbox" id="checkbox" value="music" /> 音乐 </label> <input type="submit" name="Submit" value="提交" /> </form> <form id= "form1 " name= "form1 " method= "post " action= " "> <label> <input type= "checkbox " name= "checkbox[] " value= "game " /> 游戏 <input name= "checkbox[] " type= "checkbox " id= "checkbox " value= "movie " /> 电影 <input name= "checkbox[] " type= "checkbox " id= "checkbox " value= "music " /> 音乐 </label> <input type= "submit " name= "Submit " value= "提交 " /> </form> <form id="form1" name="form1" method="post" action=""> <label> <input type="checkbox" name="checkbox[0]" value="game" /> 游戏 <input name="checkbox[1]" type="checkbox" id="checkbox" value="movie" /> 电影 <input name="checkbox[2]" type="checkbox" id="checkbox" value="music" /> 音乐</label> <input type="submit" name="Submit" value="提交" /></form><?php //获取复选框多个值if ($_POST['checkbox']!=""){ $box=$_POST['checkbox'];foreach ($box as $key=>$value){ echo $key,$value; }}?>谢谢 搞定了!!! 用数组,设置复选框的名字为name[] 求一个上传FLASH文件的实例!谢谢各位大侠!小弟拜谢! 关于EBAY接口之问题 给一个PHP防SQL注入的方法吧 pHP ob_start 乱码 谁知道www.soft8.net实现的方法或给参考代码?? 问一个问题, .htaccess写错了,怎么更改或者删除? gd库 不支持gif 到底如何解决啊? 有没有截取google搜索结果的代码? php有没有直接调用打印命令的语句 有没有开源的在线excel编辑的源码 RSS 采集的问题 求助,一个关于正则表达式截取字符串的问题
<label>
<input type="checkbox" name="checkbox" value="game" />
游戏
<input name="checkbox" type="checkbox" id="checkbox" value="movie" />
电影 <input name="checkbox" type="checkbox" id="checkbox" value="music" />
音乐</label>
<input type="submit" name="Submit" value="提交" />
</form>
<?php
if ($_POST['checkbox']!=""){
$box=$_POST['checkbox'];
echo $box;
}
?>
<input type="checkbox" name="Name[]" value="Value_1" />
...
<input type="checkbox" name="Name[]" value="Value_n" />$chk = $_POST["Name"]; //$chk是一个数组
if ($_POST['checkbox']!=""){
$box=$_POST['checkbox'];
foreach ($box as $value){
echo $value;
}
}
?>
是这样吗 出错了啊
<label>
<input type="checkbox" name="checkbox[]" value="game" />
游戏
<input name="checkbox[]" type="checkbox" id="checkbox" value="movie" />
电影 <input name="checkbox[]" type="checkbox" id="checkbox" value="music" />
音乐 </label>
<input type="submit" name="Submit" value="提交" />
</form>
<label>
<input type= "checkbox " name= "checkbox[] " value= "game " />
游戏
<input name= "checkbox[] " type= "checkbox " id= "checkbox " value= "movie " />
电影 <input name= "checkbox[] " type= "checkbox " id= "checkbox " value= "music " />
音乐 </label>
<input type= "submit " name= "Submit " value= "提交 " />
</form>
<label>
<input type="checkbox" name="checkbox[0]" value="game" />
游戏
<input name="checkbox[1]" type="checkbox" id="checkbox" value="movie" />
电影 <input name="checkbox[2]" type="checkbox" id="checkbox" value="music" />
音乐</label>
<input type="submit" name="Submit" value="提交" />
</form>
<?php //获取复选框多个值
if ($_POST['checkbox']!=""){
$box=$_POST['checkbox'];
foreach ($box as $key=>$value){
echo $key,$value;
}
}
?>谢谢 搞定了!!!