Support

Account

Home Forums General Issues How to display unchecked choices Reply To: How to display unchecked choices

  • 
    <?php 
      while (have_rows('car_info', 51)) {
        the_row();
        $values = get_sub_field('car_what_covered');
        $field = get_field_object('car_what_covered');
        $choices = $field['choices'];
        foreach ($choices as $choice) {
          ?>
            <div class="point-row"><?php echo $choice; ?>
              <?php
                if ($values && in_array($choice, $values)) {
                  echo ' (checked)';
                } else {
                  echo ' (not checked)';
                }
              ?>
            </div>
          <?php 
        } // end foreach choice
      } // end while have_rows