[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to remove something in a shopping cart?

Posted on 2011-05-03
2
Medium Priority
?
750 Views
Last Modified: 2012-05-11
Hi, I am trying to remove an item from my shopping cart like so:

<input type="submit" value="Remove" name="delete[b3]" class="submit">

function removeItem() {
    if(isset($_POST['delete'])) {
        foreach($_POST['delete'] as $item) {
            $item = trim(mysql_clean_strings($item));
            unset($_SESSION['cart'][$item]);
		}
    }
}

Open in new window


But its not working. Any ideas?
0
Comment
Question by:FairyBusiness
2 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 35540402
function removeItem() {
    if(isset($_POST['delete']) ) {
        foreach($_POST['delete'] as $item =>$v ) {
            $item = trim(mysql_clean_strings($item));
            unset($_SESSION['cart'][$item]);
            }
    }
}
0
 

Author Comment

by:FairyBusiness
ID: 35541296
wow and its even gone when I hit the back button!!  :))
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month17 days, 21 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question