Baffled by Undefined Index in Simple Array: Please Help!

Posted on 16th Feb 2014 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

Other forums