How to remove something in a shopping cart?

Posted on 2011-05-03
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));

Open in new window

But its not working. Any ideas?
Question by:FairyBusiness
    LVL 82

    Accepted Solution

    function removeItem() {
        if(isset($_POST['delete']) ) {
            foreach($_POST['delete'] as $item =>$v ) {
                $item = trim(mysql_clean_strings($item));

    Author Comment

    wow and its even gone when I hit the back button!!  :))

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    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…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    730 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now