₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,346,696 members, 8,524,684 topics. Date: Wednesday, 25 November 2026 at 10:42 AM

Toggle theme

Adeyeye546's Posts

Nairaland Forum › Adeyeye546's Profile › Adeyeye546's Posts

1 (of 1 pages)

Programming › Trying 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)