fwbn 发表于 2018-3-12 15:39:05

set_checkbox的回填,需要string,不能是int

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’),
                );



手册里似乎没有写,大家又遇到过类似的问题吗?
页: [1]
查看完整版本: set_checkbox的回填,需要string,不能是int