sasori Posted January 28, 2012 Share Posted January 28, 2012 Hi, 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] => [email protected] [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] => [email protected] [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] => [email protected] [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 Quote Link to comment https://forums.phpfreaks.com/topic/255925-how-to-get-the-values-of-the-array/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 28, 2012 Share Posted January 28, 2012 See the methods in this post - http://www.phpfreaks.com/forums/index.php?topic=352617.msg1664982#msg1664982 Quote Link to comment https://forums.phpfreaks.com/topic/255925-how-to-get-the-values-of-the-array/#findComment-1311899 Share on other sites More sharing options...
sasori Posted January 28, 2012 Author Share Posted January 28, 2012 ^ thanks.. but, is paypal sandbox always like that?, am coding on my local, and when i do a transaction using the sandbox, sometimes i get an array, sometimes, it's empty..why is that?..is it just me or it's with the sandbox itself ? Quote Link to comment https://forums.phpfreaks.com/topic/255925-how-to-get-the-values-of-the-array/#findComment-1311909 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.