This question already has an answer here:
I'm working on selecting multiple checkboxes and store it to my database but when I call the name of the checkboxes which is array "living_whom[]" and store it to my variable in php the error say that "Undefined index: living_whom". I can't find what is problem. Here's the code:
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Living with whom</span></label>
<div class="row">
<div class="col-md-2">
<label class="checkbox-inline">Parents
<input type="checkbox" name="living_whom[]" value="Parents">
<span class="checkmark"></span>
</label>
</div>
<div class="col-md-3">
<label class="checkbox-inline">Brothers & Sisters
<input type="checkbox" name="living_whom[]" value="Brothers & Sister">
<span class="checkmark"></span>
</label>
</div>
<div class="col-md-2">
<label class="checkbox-inline">Grandparents
<input type="checkbox" name="living_whom[]" value="Grandparents">
<span class="checkmark"></span>
</label>
</div>
<div class="col-md-2">
<label class="checkbox-inline">Other Relatives
<input type="checkbox" name="living_whom[]" value="Other Relatives">
<span class="checkmark"></span>
</label>
</div>
<div class="col-md-2">
<label class="checkbox-inline">Friends
<input type="checkbox" name="living_whom[]" value="Friends">
<span class="checkmark"></span>
</label>
</div>
</div>
</div>
</div>
</div>
and when I get the name of the checkboxes in php:
$living_whomArr = $_POST["living_whom"];
Thank you for the help!
Aucun commentaire:
Enregistrer un commentaire