I am coding a shopping cart. This is just part of the code. I want to be able to echo all item names in the cart. Only allows me to echo only the last added item name.
<?php
if(!empty($_SESSION["shopping_cart"]))
{$total = 0;foreach($_SESSION["shopping_cart"] as $keys => $values)
{
?>
<tr>
<td><?php echo $values["item_name"]; ?></td>
<td><?php echo $values["item_quantity"]; ?></td>
<td>$ <?php echo $values["item_price"]; ?></td>
<td>$ <?php echo number_format($values["item_quantity"] * $values["item_price"], 2);?></td>
<td><a href="index.php?action=delete&id=<?php echo $values["item_id"]; ?>"><span class="text-danger">Remove</span></a></td>
</tr>
<?php
$total = $total + ($values["item_quantity"] * $values["item_price"]);}
?>
<?php
echo($values["item_name"]);
?>