I just want to store HTML data in a PHP variable. But the problem is that the data also contains a PHP function
$CartItem = "<table style='width:100%'>
<tr>
<th style='text-align:left;'><strong>Code</strong></th>
<th style='text-align:left;'><strong>ItemName</strong></th>
<th style='text-align:right;'><strong>Quantity</strong></th>
</tr>". foreach ($_SESSION["cart_item"] as $item){ .
"
<tr>
<td style='text-align:left;border-bottom:#F0F0F0 1px solid;'>" .echo $item["ItemCode"]; ."</td>
<td style='text-align:left;border-bottom:#F0F0F0 1px solid;'><strong>" .echo $item["ItemName"];."</strong></td>
<td style='text-align:right;border-bottom:#F0F0F0 1px solid;'>". echo $item["quantity"];."</td>
</tr>".
} ."
</table>";
I just want to create HTML code using a PHP foreach
loop and store them in $CartItem
.
Please help me with correct code.
My code has an error
( ! ) Parse error: syntax error, unexpected 'foreach' (T_FOREACH) in C:\wamp\www\drupal-7.38\shoppingcart\initiateOrder\index.php on line 70