set_checkbox值未返回

[enter image description here][1]i want repopulate my form using edit button once i clicked edit button it ll shows what are all the selected items are to be displayed

<input type="checkbox" id="mycheck1" name="certid[]" 
  value="1" class="cbx"  <?php echo set_checkbox('certid','1');?>

Controller

   $data['getcert'] = $this->User_Model->getcert();

  output should be in the form of array 

   Array
  (
  [id] => 1
  [certificate_id] => 1
  [fee] => 500
  [APPNO] => 10001
  [regno] => 01107402042
  [certid] => 1
  [noc] => 2
  [paid] => 1000
  )


 <?php foreach($getcert as $student){ 
   echo '<pre>';
    print_r($student);
    echo '</pre>';
    ?>
 <td width="50px" align="center">1</td>
 <td>Transcripts  & Degree Certificate Attestation</td>
  <td align="center"><input type="checkbox" id="mycheck1" name="certid[]" 
   value="<?php echo (!isset($student['certid'])) ? 1 : $student['certid'] 
      ?>"
    class="cbx"  <?php echo set_checkbox('certid[]','1');?> ></td>
     <td> 500 </td>
    <td> <input type="number" id="primaryincome1"  min="1"  max="999" 
 name="noc[]" 
   value="<?php echo (!isset($student['noc'])) ? '' : $student['noc'] ?>"
   disabled> </td>
  <div class="col-xs-2">
    <td ><input type="text" id="totalamountremaining1"  name="txt" 
    class="text-right" value="<?php echo (!isset($student['paid'])) ? 0 : 
     $student['paid'] ?>"  size="5"></td>
      </div>

    that certid value only be placed in checkbox

This values are stored in db .how to assign that value in this view?

This is not direct answers to your question but you will get an idea how to do this.

In the HTML:

<input type="hidden" name="certid" value="<?php print base64_encode(serialize($result)); ?>">

And in the controller:

$data = unserialize(base64_decode($this->input->post('certid')));

Using this method you can pass the array data from the frontend to your controller.

Right so, apparently set_checkbox() is more of something to be used when repopulating fields from form validation. E.g. the field has a post value and that post value needs to be brought back when validation fails. So it's not really something for determining if the db field matches the checkbox value.

Now I'm assuming that the logic you want is that if the value in the db for certid is 1 then the checkbox should be checked. In which case you can do:

<input type="checkbox" id="mycheck1" name="certid[]" value="<?php echo (!isset($student['certid'])) ? 1 : $student['certid'] ?>" class="cbx" <?php if ($student['certid'] == 1):?> checked="checked"<?php endif;?>>

try this:

<input type="checkbox" id="mycheck1" name="certid[]" value="1" class="cbx" <?php echo set_checkbox('certid','1', $certid==1;?>>

with $certid as your db value

from manual:

third (optional) parameter lets you set an item as the default (use boolean TRUE/FALSE)'

so you test your db value if it fits the checkbox value, thats it.