I have an array with a reference, a price and a quantity in an array. I have a foreach set in a html table, and I would like a line break after each quantity but I can't make it work.
if (isset($_SESSION["buy"])) :
$cart = $_SESSION["buy"];
endif;
if (!empty($_POST["quantity"])) :
array_push($cart, $_POST['ref']);
array_push($cart, $_POST['price']);
array_push($cart, $_POST["quantity"]);
$_SESSION["buy"] = $cart;
endif;
<table>
<thead>Your order</thead>
<tr>
<td>Ref</td>
<td>Price</td>
<td>Quantity</td>
</tr>
<tr>
<?php foreach ($cart as $row => $data) : ?>
<td>
<?php echo $data; ?>
</td>
<?php endforeach; ?>
</tr>
</table>
Whatever I try, the result will only be a single column or row.
How can I force it to line break after each $data(quantity)