Support

Account

Home Forums General Issues Retrieve multiple checkbox values outside foreach loop Reply To: Retrieve multiple checkbox values outside foreach loop

  • You won’t be able to output all of them unless they are in your loop. I’m not sure what your initial $discipline; call is as well as the one within your loop. You’re not doing anything with it there.

    You’ll need something like this:

    
    <?php
    $output_map[$the_ID]['map'] = '<div class="marker" data-lat="'.$location['lat'].'" data-lng="'.$location['lng'].'"></div>';
    
    $disciplines = get_field("form_disciplines");
    // $discipline; not sure what this is?
    
    if( $disciplines ):
    foreach ($disciplines as $discipline) {         
        echo '<p>' . $discipline . '</p>';
    }
    endif;
    ?>
    

    Your map marker output doesn’t include any of the code in your loop so you can put it before or after your foreach loop depending on where you need it.