Written by Anonymous
<?php
session_start();
$id = $_GET['id'];
if (($id !="")) //nếu có id truyền vào
{
if (isset($_SESSION['cart']['$id']))
{
//tăng số lượng lên 1
$_SESSION['cart'][$id]++;
}
else //nếu chưa có trong session
{
$_SESSION['cart'][$id] = 1; //mặc định 1
}
}
header('Location: cart.php');
?>