remove item

PHOTO EMBED

Sat Jan 15 2022 10:44:43 GMT+0000 (UTC)

Saved by @emleons23 #php

case "remove":
	if(!empty($_SESSION["cart_item"])) {
		foreach($_SESSION["cart_item"] as $k => $v) {
			if($_GET["code"] == $k)
				unset($_SESSION["cart_item"][$k]);				
			if(empty($_SESSION["cart_item"]))
				unset($_SESSION["cart_item"]);
		}
	}
	break;
case "empty":
	unset($_SESSION["cart_item"]);
        break;
content_copyCOPY

https://phppot.com/php/simple-php-shopping-cart/