Hello All,
I am new to PHP and the requirement is, i need to design a form with multiple checkboxes with same name. I tried using arrays and the code is
<td>
<input type="checkbox" name="eroom_status[]" value="empty"
<?php if(isset($_POST['eroom_status'])) {
if (in_array('empty',$POST['eroom_status']) {
$check = 'checked';}
} echo $check;?> >
</td>
<td>
<input type="checkbox" name="eroom_status[]" value="Rejected"
<?php if(isset($_POST['eroom_status'])) {
if (in_array('Rejected',$POST['eroom_status'])) { $check = 'checked'; }
}?> <?php echo $check;?> >
</td>
<td>
<input type="checkbox" name="eroom_status[]" value="New To Airbus"
<?php if(isset($_POST['eroom_status'])) {
if (in_array('New To Airbus',$POST['eroom_status'])) { $check = 'checked'; }
} echo $check;?> >
</td>
<td>
<input type="checkbox" name="eroom_status[]" value="Closed"
<?php if(isset($_POST['eroom_status'])) {
if (in_array('Closed',$POST['eroom_status'])) { $check = 'checked'; }
} echo $check; ?> >
</td>
<td> <input type="checkbox" name="eroom_status[]" value="Closed with Comments"
<?php if(isset($_POST['eroom_status'])) {
if (in_array('Closed with Comments',$POST['eroom_status'])) { $check = 'checked'; }
} echo $check; ?> >
</td>.
I am getting an error message. In in_array() function the second parameter is null. Please help me regarding this issue.