Hi,
I have an array of checkboxes which are being checked by default. I don’t want them checked. Can anyone see why they are being checked?
Here is the array,
$examSearch = array ( array ( 'name' => 'AS', 'selected' => 'FALSE'),
array ( 'name' => 'AS', 'selected' => 'FALSE'),
array ( 'name' => 'A2', 'selected' => 'FALSE'),
array ( 'name' => 'GCSE', 'selected' => 'FALSE'),
array ( 'name' => 'AP', 'selected' => 'FALSE'),
array ( 'name' => 'KET', 'selected' => 'FALSE'),
array ( 'name' => 'PET', 'selected' => 'FALSE'),
array ( 'name' => 'FCE', 'selected' => 'FALSE'),
array ( 'name' => 'IELTS', 'selected' => 'FALSE'));
And here is the HTML
<table class="inner" id="searchTable">
<th>Exam Type:</th>
<?php foreach($examSearch as $searchExam): ?>
<tr><td class="left"><input type="checkbox" class="year" id="<?php htmlout($searchExam['name']); ?>" name="exams[]" value="<?php htmlout($searchExam['name']); ?>"
<?php
if ($searchExam['selected'])
{
echo 'checked';
}
?>><?php htmlout($searchExam['name']); ?></td></tr>
<?php endforeach; ?>
</table>
I thought that since $searchExam[‘selected’] is FALSE what is inside the if statement should not work until a box is checked.
Thanks