Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,980 members, 7,956,664 topics. Date: Monday, 23 September 2024 at 04:35 PM |
Nairaland Forum / Science/Technology / Programming / Trying To Remove Item Fro A Shopping Cart. (1510 Views)
How Can I Create A Shopping Cart? / Programming Shopping Cart Issue Wondering How They Do It / Trying To Run Php Project After Installing Wamp Server (2) (3) (4)
Trying To Remove Item Fro A Shopping Cart. by adeyeye546: 10:59am On Oct 09, 2014 |
<?php if (isset($_POST['index_to_remove']) && $_POST['index_to_remove'] != "" { // 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" } 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 }; } |
Re: Trying To Remove Item Fro A Shopping Cart. by javadoctor(m): 3:41am On Oct 12, 2014 |
I don't understand php, but in java you could simply remove the object from a Map With a key value. Map <CartItem,Integer>item = new HashMap(); |
Re: Trying To Remove Item Fro A Shopping Cart. by asalimpo(m): 6:56am On Oct 12, 2014 |
*Simply use ur hand to remove it and return it to d store shelf! If ur in a supermarket/mart. If online use the "remove/delete/save for l8r" button * pardon the sakazm but ur question is ripe for misinterpretation. |
Re: Trying To Remove Item Fro A Shopping Cart. by Nobody: 9:37am On Oct 12, 2014 |
javadoctor:True, PHP does the same. @op, just use var_dump($_POST); to get the structure of the array - you can then post it here so we tell you how to remove it - i might not be here, i am hardly here these days. Been building my www.Nairaland.com - and that is taking like all my time. asalimpo:That your act is known as thievery and is punishable by life imprisonment. |
(1) (Reply)
Real Wifi Hacking App For Android Is Here. / CBT Software For Sale (WE WANT TO SELL THE SOFTWARE RIGHT/LICENCE) / Are You Looking For Website Development?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 9 |