0

I am trying to get my 'checkbox' on an application to respond to the php file. Currently, it is responding and giving me ALL the checkbox on the application page but I need the selected checkboxes.

HTML

 <div class="input-group">
     <div class="btn-group input-group form-group" data-toggle="buttons">
     <label class="btn purplebtn">
         <input type="checkbox" id="math_select" value= "math_select" /> 
         MATH  
     </label>
     <label class="btn purplebtn">
         <input type="checkbox" id="science_select" value="science_select" /> 
         SCIENCE 
     </label>
     ... (I have 6 other selections) ...
  </div>
</div>

PHP

$math_select = $_POST['math_select'];

$science_select = $_POST['science_select'];

My application then shows all the the options, rather than the what is actually selected while filling out the form.

Thank you

David Lee
  • 2,040
  • 17
  • 36
KWK1013
  • 1
  • 1

1 Answers1

1

PHP uses the name attribute. The correct is:

<input type="checkbox" name="math_select" value= "math_select">
<input type="checkbox" name="science_select" value= "science_select">
nankran
  • 26
  • 4