I am getting the values from database as an array
<?php
foreach($this->getlist as $value){
foreach($this->listOfdealers as $list){
?>
<tr>
<td>
<input type="checkbox" name="list[]" value=<?php echo $list->nList?>
<?php if($value->nSubList==$list->nList){echo 'checked'; } ?> />
<label for="list_32"><?php echo $list->nList?>
</label>
</td>
</tr>
<?php
}
}
?>
I just want to compare two array values and display the checkbox checked when they are equal, but here there are displaying 16 checkbox instead of four,as I am using two for loops and I dont want that.
$this->getlist is an array that is returning from database
getListandlistOfdealersrepresent? Which one should relate to the generation of checkboxes?