Baffled by Undefined Index in Simple Array: Please Help!


Posted on 16th Feb 2014 07:03 pm by admin

Hello. I have a form which posts an array to this script. However, I can't seem to access the values in the array; I keep getting an undefined index. Something is not right, but the code is so simple! What am I missing?

print_r($_POST['Item'][0]);
// Output is: Array ( ['Quantity'] => 1 ['Item_id'] => 5 )
echo $_POST['Item'][0]['Quantity'];
// Output is: Notice: Undefined index: Quantity in /Volumes/Macintosh HD/Sites/.../hal/item/reconcile.php on line 30

No comments posted yet

Your Answer:

Login to answer
76 Like 29 Dislike
Previous forums Next forums
Other forums

DB2 for z/OS, LUW, iSeries
Hello, In this forum a lot of threads related to other members of the DB2 family than DB2 for z/OS

Please Help my PHP Dating Function.
Hi everyone!

Well here is my code that displays this:

It works wonderful.


php call servlet
I have done a php backup application .
So there is a form that user pick some files to zip and d

Problem Dereferencing
With these types and tables:

CREATE TYPE MANAGER AS OBJECT (
MGR_ID INTEGER,

CHECK A STRING FOR ' " ' (DOUBLE QUOTES)
I am checking for delimiter (.!?) and if there is a " after a sentence then it should neglect a

convert PHP array to Javascript array
I have a page that gets a request sent from AJAX, and I am trying to convert a PHP array to a javasc

contact form - output to page and email
I have the following in my controller:

$message['name'] = htmlentities(strip_tags(trim($_POST

True way to see if action was successful?
If this is a good way to see if action was successful to continue:

Code: function changeGa

xml element exists
Code: [Select]<?xml version="1.0"?>
<Addresses>
<

PHP code needed to get/post form fields and request mysql query results.
I'm new to PHP

I've created an html form to allow the user to request a basic telephone dire

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash