用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1671|回复: 2
收起左侧

[版本 3.x] set_checkbox的回填,需要string,不能是int

[复制链接]
发表于 2018-3-12 15:39:05 | 显示全部楼层 |阅读模式
ci 2.0,是可以回填的,升级到3.0,回填失效。

controller 里赋值

                $condition = array(
                          'receipt_flag' => array(0),
                );


view里

                                                        <input type="checkbox" id="receipt_flag_0" name="receipt_flag[]" value="0"  <?php echo set_checkbox('receipt_flag[]', 0); ?> /><label for="receipt_flag_0">未开票</label>
                                                        &nbsp;&nbsp;
                                                        <input type="checkbox" id="receipt_flag_1" name="receipt_flag[]" value="1"  <?php echo set_checkbox('receipt_flag[]', 1); ?> /><label for="receipt_flag_1">已开票</label>



================================================================
后来研究发现是赋值的问题。
controller 里修改如下,就可以了

                $condition = array(
                          'receipt_flag' => array(‘0’),
                );



手册里似乎没有写,大家又遇到过类似的问题吗?

本版积分规则