thinkphp取不到checkbox的值 10
<inputtype="checkbox"name="week[]"id="week1"value="1"/>周一<inputtype="checkbox"name="w...
<input type="checkbox" name="week[]" id="week1" value="1" />周一
<input type="checkbox" name="week[]" id="week2" value="2" />周二
<input type="checkbox" name="week[]" id="week3" value="3" />周三
<input type="checkbox" name="week[]" id="week4" value="4" />周四
<input type="checkbox" name="week[]" id="week5" value="5" />周五
<input type="checkbox" name="week[]" id="week6" value="6" />周六
<input type="checkbox" name="week[]" id="week0" value="0" />周日
获取值:
$week = $_POST ['week'];
var_dump($week);
获取到的不是选中的值,而是字符串"Array"
是哪里错了吗? 展开
<input type="checkbox" name="week[]" id="week2" value="2" />周二
<input type="checkbox" name="week[]" id="week3" value="3" />周三
<input type="checkbox" name="week[]" id="week4" value="4" />周四
<input type="checkbox" name="week[]" id="week5" value="5" />周五
<input type="checkbox" name="week[]" id="week6" value="6" />周六
<input type="checkbox" name="week[]" id="week0" value="0" />周日
获取值:
$week = $_POST ['week'];
var_dump($week);
获取到的不是选中的值,而是字符串"Array"
是哪里错了吗? 展开
2个回答
展开全部
<?php
if(isset($_POST['week'])){
var_dump($_POST['week']);
}
?>
<form action="" method="post">
<input type="checkbox" name="week[]" id="week1" value="1" />周一
<input type="checkbox" name="week[]" id="week2" value="2" />周二
<input type="checkbox" name="week[]" id="week3" value="3" />周三
<input type="checkbox" name="week[]" id="week4" value="4" />周四
<input type="checkbox" name="week[]" id="week5" value="5" />周五
<input type="checkbox" name="week[]" id="week6" value="6" />周六
<input type="checkbox" name="week[]" id="week0" value="0" />周日
<input type="submit" value="提交" />
</form>
没什么问题
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询