A strange issue. this is the array with some values
$et_er_facilities = ( [0] => Swimming pool
[1] => Squash court
[2] => Mini market
[3] => Playground )
If I add a few checkboxes to check whose value is present in the array above, I am trying to use in_array function. The function works for first check, but on all the next checks, it doesn't work. Here is my code.
<input type="checkbox" id="facilities1" value="Swimming pool" name="et_er_facilities[]" <?php if (in_array("Swimming pool", $et_er_facilities)) {?>checked="checked"<?php }?>>
<input type="checkbox" id="facilities4" value="Squash court" name="et_er_facilities[]" <?php if (in_array('Squash court', $et_er_facilities)) {?>checked="checked"<?php }?>>
<input type="checkbox" id="facilities5" value="Mini market" name="et_er_facilities[]" <?php if (in_array('Mini market', $et_er_facilities)) {?>checked="checked"<?php }?>>
<input type="checkbox" id="facilities7" value="Playground" name="et_er_facilities[]" <?php if (in_array('Playground', $et_er_facilities)) {?>checked="checked"<?php }?>>
So this is how its working currently. If in the array above, the first value is Playground, the checkbox will select only Playground, no other it will select automatically.
In all cases, it just matches the first value of the array and selects the appropriate check box, but doesn't select the others if they match too.
Any help, will be highly appreciated.
Thanks