Re-populate checkbox if it fails in validation in an edit form in Codeigniter

前端 未结 5 379
谎友^
谎友^ 2021-01-16 18:13

I works on the an data-edit form in codeigintier. And the problem is about re-populate checkbox

It works if it is an add form (that means I need not concern about th

5条回答
  •  失恋的感觉
    2021-01-16 19:11

    set_checkbox takes a third argument to set the default state, so basically you have to do something like this

    $checked = FALSE; if($customer_group[0]['is_default']){ $checked = TRUE; }

    echo set_checkbox('is_default', 1, $checked); 
    

提交回复
热议问题