|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-04-09 09:16 UTC] martijn at tiel dot nu
When passing an array through a form echo is running into trouble. example: <form action="array.php" method="post"> Name: <input type="text" name="personal[name]"><br> Email: <input type="text" name="personal[email]"><br> <input type="submit"> on the next page, i'm trying to retrieve the values: print_r($personal) says: Array ( [name] => martijn [email] => martijn@tiel.nu ). echo "$HTTP_POST_VARS['personal']['name']"; no value is being displayed. echo $HTTP_POST_VARS['personal']['name']; (whithout "") the value is displayed, but the function 'echo' doesn't work properly anymore. I hope someone can explain me why. regards Martijn PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 13:00:01 2025 UTC |
Try putting {} around the variable name..This works: echo "{$HTTP_POST_VARS['personal']['name']}"; RTM!echo "this is {$foo['bar']['baz']} an array index"; echo "this is $foo[bar][baz] an array index"; both versions will work. this is (and has been since I remember) documented in the manual.