2 回答
TA贡献1848条经验 获得超6个赞
看法:
<input type='checkbox' name='cname' value="<?php echo 'cvalue'; ?>">//changes
<input type='hidden' name='asap[]' value="1" >
<!--removed right space from value-->
<input type='hidden' name='asap[]' value="2" >
<!--removed right space from value-->
<input type='hidden' name='asap[]' value="3" >
<!--removed right space from value-->
控制器:
//here you have syntax error use `=` instead `=>`
$postData = $this->input->post();
//you get all your post data, if you added `name` attribute only
print_r($postData);
//it will return you first hidden value
print_r($postData['asap'][0]);
echo '------------';
echo 'loop values';
$asap = $this->input->post('asap');
foreach($asap as $row){
echo $row.'<pre>';
}
输出:
Array
(
[cname] => cvalue
[asap] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
)
1
----------
loop values
1
2
3
- 2 回答
- 0 关注
- 108 浏览
添加回答
举报