lundi 26 juin 2017

Display the names of checkboxes from an array

I'm attempting to display the names of my checkboxes with the foreach statement below, but all I'm getting is "on" for each one checked. I've got the code for one of the checkboxes and was wondering if there is anything I can change in it to make this work.

 if(!empty($_POST['OUSdrop'])){
                    foreach($_POST['OUSdrop'] as $check){
                            echo $check;

                    }
 }


 <label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="UKSen">
            <input type="checkbox" id="UKSen" name="OUSdrop[]" class="mdl-checkbox__input">
            <span class="mdl-checkbox__label" value="UK">United Kingdom</span>
 </label>




Aucun commentaire:

Enregistrer un commentaire