loops - Printing a HTML table iterating through 3 cycles PHP -


i need print on screen html table reaches data looping various times on nested data. fill header table looping through quotes array , fill second header left of table looping through items need see. problem comes when need loop through information of table in case prices list , print ones fitting both conditions. 1) element quotes array , 2) price correspond exact item on left.

i more or less <td> tags ones need , data ends outside limits of table.

i appreciate if can give me ideas how approach issue.

the structure of quotes array includes nested array prices

(int) 0 => array(     'quote' => array(         'id' => '1',     ),     'price' => array(         (int) 0 => array(             'id' => '1',             'price' => '20.00',             'payment' => 'a',         ),                     (int) 1 => array(             'id' => '2',             'price' => '50.00',             'payment' => 'b',         )     ),     'order' => array()); 

and actual code printing more tags ones needed

<table>     <tr>         <td colspan="2"><?php echo __('order no.'); ?></td>         <td colspan="12"><?php echo __('list of quotes'); ?></td>     </tr>     <tr>         <td colspan="2"><?php echo __('list of item'); ?></td>     <?php foreach ($quotes $quote): ?>             <td colspan="3"><?php echo __('quote'); ?> <?php echo h($quote['quote']['id']); ?></td>        <?php endforeach; ?>     </tr>     <tr>         <td><?php echo __('id'); ?></td>         <td><?php echo __('description'); ?></td>     <?php   foreach ($quotes $quote): ?>         <td><?php echo __('id'); ?></td>         <td><?php echo __('price'); ?></td>         <td><?php echo __('payment'); ?></td>     <?php endforeach; ?>     </tr>      <?php  foreach ($items $item):?>       <tr>        <td><?php echo h($item['item']['id']); ?></td>             <td><?php echo h($item['item']['descripcion']); ?></td>          <?php  foreach ($quotes $quote): ?>                  <?php foreach ($quote['price'] $price): ?>                    <?php if($price['item_id']==$item['item']['id'] ): ?>                     <td><?php echo h($price['item_id']); ?></td>                     <td><?php echo h($price['quote_id']); ?></td>                     <td><?php echo h($price['id']); ?></td>                 <?php else: ?>                       <td></td>                     <td></td>                     <td></td>                 <?php endif; ?>                  <?php endforeach; ?>          <?php endforeach; ?>     </tr>     <?php endforeach; ?>  </table> 


Comments