空购物车按钮无法删除购物车

时间:2020-01-27 19:46:13

标签: php html

试图将其清空并在按下按钮后将购物车更新为空 但它会刷新,并且所有商品仍在购物车中

<?php
    session_start();
    include($_SERVER["DOCUMENT_ROOT"] . "/includes/header.php");
    include($_SERVER["DOCUMENT_ROOT"] . "/includes/connection/connection.php");
    include($_SERVER["DOCUMENT_ROOT"] . "/includes/definitions.php");

    $user = $_SESSION['customer_id'];
    $cart_id = $_SESSION['cart_id'];

那是我的购物车php的顶部 这是按钮

<a href="/cart/destroy_sessions.php"><button id="cart_empty_button">Empty Cart</button> </a>

最后是我的存储会话php

unset($_SESSION['add_to_cart']);
unset($_SESSION['product_id']);
unset($_SESSION['price']);
unset($_SESSION['quantity']);
echo "<meta http-equiv='refresh' content='0;url=http://sales.prosourceedm.com/cart/view_cart.php'>";

0 个答案:

没有答案