Using get_option() for check box field

This may not exactly answer the question, but let’s see the issues with your code:

  1. If you want to save the data in the same format as the default value ($fields_default), then:

    1. Start your foreach like so: foreach ( $orderdescider as $i => $item ).

    2. Then inside that foreach, $id and $checkbox should always be set and defined like so:

      $id = isset( $item['id'] ) ? $item['id'] : '';
      $checkbox_check = isset( $item['checkbox_check'] ) ? $item['checkbox_check'] : '';
      
    3. And use the appropriate value in the field’s name:

      <input type="hidden" name="orderdescider[<?php echo $i; ?>][id]"
        value="<?php echo $id; ?>">
      
      <input type="checkbox" name="orderdescider[<?php echo $i; ?>][checkbox_check]"
        value="1" ...>
      
  2. For the checkbox fields, you can use this format when writing the markup:

    <input type="checkbox" value="{value}"<?php // wrapped for clarity
      checked( '{value}', '{current/saved value}' ) ?> ...>
    

    so in your case, it would look like this:

    <input type="checkbox" name="orderdescider[<?php echo $i; ?>][checkbox_check]"
      value="1"<?php checked( '1', $checkbox_check ) ?> ...>
    

    where 1 is the {value}, and $checkbox_check is the {current/saved value}.

    (See the reference for more details about using the checked() function.)

Hope that helps, and here’s the full foreach code I used for testing: (I omitted the field’s id, but make sure to use unique values)

foreach ($orderdescider as $i => $item) {
    $id = isset( $item['id'] ) ? $item['id'] : '';
    $checkbox_check = isset( $item['checkbox_check'] ) ? $item['checkbox_check'] : '';
    ?>
    <li class="sortable-item flexit">
        <div class="form-check">
            <input type="hidden" name="orderdescider[<?php echo $i; ?>][id]"
              value="<?php echo $id; ?>">
            <input type="checkbox" name="orderdescider[<?php echo $i; ?>][checkbox_check]"
              value="1"<?php checked( '1', $checkbox_check ) ?> class="form-check-input">
        </div>
    </li>
    <?php
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)