<?php
session_start();

if (isset($_GET['id'])) {
    $item_id = $_GET['id'];

    // Check if the item exists in the cart
    if (isset($_SESSION['cart'][$item_id])) {
        // Remove the item from the cart
        unset($_SESSION['cart'][$item_id]);
    }
}

// Redirect back to the cart page
header("Location: cart.php");
exit();
?>