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
Post a Comment