nested foreach in PHP problem
- by Neuquino
I'm having problems to iterate twice on the same array:
<? $indice=0 ?>
<?php foreach ($comisiones as $comision1):?>
<tr>
<td><?php echo ++$indice ?></td>
<td><?php echo tag('select',array('name'=>'comision_'.$indice),true)?>
<?php foreach ($comisiones as $comision2):?>
<option value="<?php echo $comision2->getId()?>">
<?php echo $comision2->getNombre()." - ".$comision2->getDescripcion()?>
</option>
<?php endforeach?>
</select>
</td>
</tr>
<?php endforeach?>
The above code prints:
And I'm expecting to see something like this (labels of the combos in the images are not the same, but I think the idea is clear):
Thanks in advance