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 7176893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:36:02+00:00 2026-05-28T16:36:02+00:00

I have this $_POST array coming from a paypal transaction Array ( [address_city] =>

  • 0

I have this $_POST array coming from a paypal transaction

Array
(
    [address_city] => San Jose
    [address_country] => United States
    [address_country_code] => US
    [address_name] => Test User
    [address_state] => CA
    [address_status] => confirmed
    [address_street] => 1 Main St
    [address_zip] => 95131
    [business] => test1_biz@gmail.com
    [charset] => windows-1252
    [custom] => 
    [first_name] => Test
    [item_name1] => Product Name 1
    [item_name2] => Product Name 6
    [item_name3] => Product Name 8
    [item_number1] => 1
    [item_number2] => 6
    [item_number3] => 8
    [last_name] => User
    [mc_currency] => USD
    [mc_fee] => 0.82
    [mc_gross] => 18.00
    [mc_gross_1] => 14.00
    [mc_gross_2] => 2.00
    [mc_gross_3] => 2.00
    [mc_handling] => 0.00
    [mc_handling1] => 0.00
    [mc_handling2] => 0.00
    [mc_handling3] => 0.00
    [mc_shipping] => 11.00
    [mc_shipping1] => 11.00
    [mc_shipping2] => 0.00
    [mc_shipping3] => 0.00
    [notify_version] => 3.4
    [num_cart_items] => 3
    [payer_email] => test_biz@gmail.com
    [payer_id] => TRCLJTHLNCJ7Q
    [payer_status] => verified
    [payment_date] => 22:52:56 Jan 27, 2012 PST
    [payment_fee] => 0.82
    [payment_gross] => 18.00
    [payment_status] => Completed
    [payment_type] => instant
    [protection_eligibility] => Eligible
    [quantity1] => 1
    [quantity2] => 1
    [quantity3] => 1
    [receiver_email] => test_biz@gmail.com
    [receiver_id] => 74PV23B8KSK84
    [residence_country] => US
    [tax] => 0.00
    [tax1] => 0.00
    [tax2] => 0.00
    [tax3] => 0.00
    [test_ipn] => 1
    [transaction_subject] => Shopping CartProduct Name 1Product Name 6Product Name 8
    [txn_id] => 7BS85664SB906284D
    [txn_type] => cart
    [verify_sign] => AJ2IuqHp8G0lIxhedAqrwRQbv8fVA4-Gum9e7DMZmEWIFrljEwFCJDfP
)
1

as you can see, there are key value pairs like this,

[items_name1] => Product Name 1
[items_name2] => Product Name 2
[items_name3] => Product Name 3

those keys aren’t constant, I mean, it came from a shopping cart, so the item name depends on how many items were placed in the shopping cart to be purchased.. now my question is,
How to loop to that post array, and get only the item_names plus their corresponding values ?, because I need them and save in a db table

  • 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-28T16:36:03+00:00Added an answer on May 28, 2026 at 4:36 pm

    Loop over each element of the array and check if the key starts with "items_name" using strposdocs. If so, add it to the $items array.

    $items = array();
    foreach ($_POST as $key => $val)
    {
      if (strpos($key, 'items_name') === 0) {
        $items[$key] = $val;
      }
    }
    var_dump($items);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several variables coming from an array in $POST_['array'] i wish to make
Hi frinds I have a post data coming like this Array ( [m_categoryid] =>
I have this function from a plugin (from a previous post) // This method
Let's say I have this code: if (md5($_POST[$foo['bar']]) == $somemd5) { doSomethingWith(md5($_POST[$foo['bar']]); } I
i have this in my BlogRepository public IQueryable<Subnus.MVC.Data.Model.Post> GetPosts() { var query = from
say I have this $result = mysql_query('SELECT views FROM post ORDER BY views ASC');
I have to sort this array in descening order with the key likecount. How
Can someone please tell me where these extra characters are coming from? This is
i have this code: <?php $valid_ext = array(pdf, doc); $args = array( 'post_type' =>
I have to list several elements that are coming from a database source A

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.