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


i works on data-edit form in codeigintier. , problem re-populate checkbox

it works if add form (that means need not concern value in database):

 <?= set_checkbox('is_default', '1'); ?> checkbox 

the problem is, in edit form:

i can't repopulate checkbox

<?php if ($customer_group[0]['is_default'] == "1") echo "checked"; set_checkbox('is_default', '1'); ?> 

the checkbox check have not check in edit => fail validate in form, helping

i have set validation rule in controller, code in add form working , how handle case edit form?

set_checkbox takes third argument set default state, have this

echo set_checkbox('is_default', 1, $customer_group[0]['is_default'] == "1");  

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -