₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,327,020 members, 8,429,065 topics. Date: Thursday, 18 June 2026 at 11:36 AM

Toggle theme

Adeyeye546's Posts

Nairaland ForumAdeyeye546's ProfileAdeyeye546's Posts

1 (of 1 pages)

ProgrammingTrying To Remove Item Fro A Shopping Cart. by adeyeye546(op): 10:59am On Oct 09, 2014
<?php
if (isset($_POST['index_to_remove']) && $_POST['index_to_remove'] != ""wink {
// Access the array and run code to remove that array index
// Reomve functionality
$key_to_remove = $_POST['index_to_remove'];// hold array index to that variable and pass it to the local variable

if (count($_SESSION["cart_array"]) <= 1) { // if item greater than one
unset($_SESSION["cart_array"]);
// header("location: cart.php"wink;
} else {
unset($_SESSION["cart_array"]["$key_to_remove"]);//correspond to the cart_item
//sort($_SESSION["cart_array"])
sort($_SESSION["cart_array"]); // sorting of all the multi- dimensional array

};
}

1 (of 1 pages)