I am developing a simple online shop cart page using php and xml I have a issue while appending data to array. The working is that when we click on add to cart the id should append to an array and store in session variable:
<?php session_start();
if(!isset($_POST['addtocart']))
{
$_SESSION["array1"] =array();
array_push($_SESSION["array1"],$_GET["pid"]);
print_r($_SESSION["array1"]);
}
?>
It is not appending id only showing the id of the product that I clicked