I need to add amounts if a customer buys more than one product. how to add using session variables. I stored the amount as
$amount=$_POST['amount']
$_SESSION['amount']=$amount;
doing the following thing isnt solving the problem
$_SESSION['amount']+=$amount;
With the below code you are ovewriting the content of
$_SESSION['amount']with the current value of$_POST['amount']:You should do something like this:
Don’t forget to check if you are calling
session_start()at the beginning of the script.