<?php
session_start();

if (isset($_POST['id'])) {
    $totId = $_POST['id'];

    if (isset($_SESSION['tots'])) {
        foreach ($_SESSION['tots'] as $key => $tot) {
            if ($tot['id'] == $totId) {
                unset($_SESSION['tots'][$key]);
                break;
            }
        }
    }

    echo json_encode($_SESSION['tots']);
}
?>
