lundi 27 février 2017

How to get the name of checked checkboxes and store them in a database with using php

I have 4 checkboxes in html, and at the same time, only 2 can be selected from them. I would like to store the selected ones in a database, but I'm not sure how to put that into code. So if you could help me guide a way to storing the checked in checkboxes in a database, that would be really appreciated!

            <div id="chooseTeacher" style="margin-bottom:24px;">
                <label id="selectTeacher" class="form-control">Select your teacher(s)</label>
                <table style="width:auto;text-align:left;margin-bottom:1px;margin-top:13px" >
                    <tr>                                                  
                        <th style="font:inherit;display:flex;">
                            <input type="checkbox" id="archer" name="archer" style="display:none; position:absolute; left:9999px;" onclick="countCheckedBoxes(this)">
                            <label for="archer" style="margin-right:68px;"><span></span>Miss Archer</label>
                  
                            <input type="checkbox" id="craig" name="craig" style="display:none; position:absolute; left:9999px;" onclick="countCheckedBoxes(this)">
                            <label for="craig"><span></span>Miss Craig</label>
                        </th>
                        <th style="font:inherit;padding-right:110px;display: flex;"> 
                            <input type="checkbox" id="devine" name="devine" style="display:none; position:absolute; left:9999px;" onclick="countCheckedBoxes(this)">
                            <label for="devine" style="margin-right:65px;"><span></span>Miss Devine</label> 
                                                               
                            <input type="checkbox" id="dorrity" name="dorrity" style="display:none; position:absolute; left:9999px;" onclick="countCheckedBoxes(this)">
                            <label for="dorrity"><span></span>Miss Dorrity</label>  
                        </th>                   
                    </tr> 
                </table>
            </div>

(IN THE SNIPPET THE CHECKBOXES CAN'T BE SEEN BECAUSE I USED ANIMATIONS WITHIN CSS)




Aucun commentaire:

Enregistrer un commentaire