Add-cart.php Num -

if (isset($_SESSION['cart'][$product_id])) $_SESSION['cart'][$product_id] += $quantity; else $_SESSION['cart'][$product_id] = $quantity;

: Use intval() or similar functions to ensure num is a number to prevent malicious input or accidental errors. add-cart.php num

| Usage | Example | Meaning | |-------|---------|---------| | Quantity only | ?num=3 | Add 3 units of a predefined product | | Product ID | ?num=SKU456 | Add 1 unit of product SKU456 | | ID:Quantity | ?num=101:2 | Add 2 units of product ID 101 | | Encoded value | ?num=eyJpZCI6MjN9 | Base64‑encoded JSON | else $_SESSION['cart'][$product_id] = $quantity