Checkbox update

I have checkbox to display the months .Is good in the insert form But in the update form I want the months that have been checked in the insert form ,have checked in the update form
i used this code to dispaly check boc

 <input type="checkbox" name="months[]" id="months" value="<?php echo $key; ?>" > 

any help?

You need to add some code to see if the box was already checked, if it was add the checked=“checked” attribute the input. :slight_smile:

I know that,but how ? can you help me?

You need to emulate something similar to:-

$checked = array(

$boxes = array(

foreach($boxes as $box){
    '<input type="checkbox" %s name="%s" />' . PHP_EOL,
    in_array($box, $checked) ? 'checked="checked"' : '',

  <input type="checkbox"  name="foo" />
  <input type="checkbox" checked="checked" name="bar" />