Jump to content

passing foreach loop in html


abrahamgarcia27

Recommended Posts

i am trying to use mpdf and i am trying to pass a for each loop. i was thinking equaling to a variable, but i saw you cant do that.

foreach($rows_details as $record_details){
        echo "<td>$record_details[po_num]</td>
      <td>$record_details[warehouse_num]</td>
	  <td>$record_details[quantity]</td>
	  <td>$record_details[packages]</td>
	  <td>$record_details[weight]</td>
	  <td>$record_details[product_id]</td>
	  <td>$record_details[pieces]</td>
	  <td>$record_details[unit_price]</td>
	  <td>$record_details[total_value]</td>";
}

 

so i have to pass it through this any one have an idea


$html = '
<tr>

<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td> 


</tr>

$mpdf->WriteHTML($html);

$mpdf->Output(); exit;

exit;

Link to comment
https://forums.phpfreaks.com/topic/255116-passing-foreach-loop-in-html/
Share on other sites

Actually, you had it close:

 

foreach($rows_details as $record_details)

  {

  echo "<td>" . $record_details['po_num'] . "</td>

  etc.

  }

 

You might have to go by index number:

 

foreach($rows_details as $record_details)

  {

  echo "<td>" . $record_details[0] . "</td>

  etc.

  }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.