Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
print_r($item);
prints this:
Array ( ['note'] => sample1 ['value'] => 4 ) 
This:
echo $item['value'];
echo $item['note'];
prints nothing!

Which is what the echo's using the keys should have printed.
I can't figure this out. What am I missing?

What I have tried:

foreach($item as $i) {
   echo $i ;
}
prints as the above echo statements should have:
4
sample1
Posted
Updated 4-Jul-17 15:59pm
v3
Comments
Bryian Tan 4-Jul-17 13:49pm    
Interesting, everything seem checkout. What is the file extension? .php?

1 solution

I figured it out. It seems the quote marks around the array keys were causing an issue. This is a $_POST array so I changed my html form to eliminate the quotes. That got it working.

I was using an example from someone graciously provided me. Finally reached him and he confirmed his "typo" mistake.

Thanks for any comments.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900