php - Issue getting $_POST from multiple checkboxes -
i made form multiple checkboxes in it, follows:
<form action="" method="post"> <div class="row"> <div class="col-sm-9"> <div class="form-group"> <label>choose rooms:</label> <ul id="scegli_camere"> <li><input type="checkbox" name="rooms[]" value="101" > camera 101</li> <li><input type="checkbox" name="rooms[]" value="102" > camera 102</li> </ul> </div> </div> </div><!-- /.row --> <div class="row"> <div class="col-lg-6"> <button type="submit" class="btn btn-primary" id="btn_submit"><i class="fa fa-save"></i> modify</button> </div> </div> </form>
after submission of form, if no 1 of checkbox checked empty array, while if 1 checked, post follows:
array( [rooms] => )
why $_post['rooms'] empty?
i have checked code. working fine in environment , getting checked values.you can debug 2 things-
- wheather checkbox being checked or not while submitting form
- print_r($_post) print full post array.
hope work.
Comments
Post a Comment