I have a simple shopping cart array. I can add in the Id fine. However each time I go to submit the form it overrides the existing value? What is the best way to stop this from happening? Below is an example of when the form is submitted
session_start();
$id = filter_var($_POST['Phone-ID'], FILTER_SANITIZE_NUMBER_INT);
$Phone_Title = filter_var($_POST['Phone-title'], FILTER_SANITIZE_STRING);
$Phone_Price = filter_var($_POST['Phone-price'], FILTER_SANITIZE_STRING);
$Phone_Quantity = filter_var($_POST['quantity'], FILTER_SANITIZE_NUMBER_INT);
$_SESSION['cart']['Id'] = array();
$_SESSION['cart']['Id'] = $id;
var_dump($_SESSION['cart']);