Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5841549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:54:15+00:00 2026-05-22T11:54:15+00:00

I have a dynamic list of items pulled from a database, where the list

  • 0

I have a dynamic list of items pulled from a database, where the list contains 0 to N items. Each item is listed in a row in an HTML table with an submit button. I need to know which of these buttons, specifically, is clicked on $_POST and to obtain the value of that item.

My present approach is to use an array. However, the $_POST value returns all items in the array, not only the item that was clicked. What’s more, the array values do not correlate to the values pulled from the database. The same image submit button may be clicked repeatedly and produce different values.

<?php
else if (isset($_POST["deleteItem"]))
{   
    foreach ($_POST["deleteItem"] as $value) :
        WishList::Delete($value);
    endforeach; 
}
?>

<form method="post" action="">
    <table id="WishListTable">
<?php
    $wishlist = WishList::GetAllByID($userID);
    foreach ($wishlist as $item)
    {
    echo "<tr><td>" . $item->Description . "</td>";
    echo "<td>";
    if ($item->InStock)
    {
        $primaryEmailAlreadyUsed = true;
        echo "In Stock";
    }
    else {
        echo "Out of Stock";
    }
    echo "</td>";
    echo "<td style=\"text-align:center;\"><input type=\"image\" src=\"/images/deleteX.gif\" border=\"0\" alt=\"Delete\" id='" . $iteml->ID . "' name=\"deleteItem[]\" value=\"" . $item->ID . "\" ></td>";
    echo "</tr>";
}
?>
</table>
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:54:16+00:00Added an answer on May 22, 2026 at 11:54 am

    Try changing

    name=\"deleteItem[]\"
    

    to

    name=\"deleteItem[" . $item->ID . "]\"
    

    On submit, the sole member of deleteItem would be deleteItem[ID]

    list($deletedItemID) = array_keys($_POST['deleteItem']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamic list of items that will be used to POST information
I have created an editor template for representing selecting from a dynamic dropdown list
I have an unordered list and each of the item in the ul has
I have dynamic List Cars. Each type of certain configuration settings to edit the
I have a drop down list (select) populated from SQL. This is dynamic so
I have a dynamic list ( <ul><li></li></ul> )of items (three columns) I need to
I have created a dynamic list picker script using Jquery 1.3 and PHP that
I have created a project in Dashcode, inserted a List control, enabled a dynamic
I have dynamic array filled with bytes, which are read from .raw file with
I have a Dynamic Data Entities Web Application that uses a database with GUIDs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.