|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16513 array through http form
Submitted: 2002-04-09 09:16 UTC Modified: 2002-04-09 11:33 UTC
From: martijn at tiel dot nu Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.1.2 OS: windows xp / linux
Private report: No CVE-ID: None
 [2002-04-09 09:16 UTC] martijn at tiel dot nu
When passing an array through a form echo is running into trouble.


<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] => ).

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-09 09:18 UTC]
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit
 [2002-04-09 09:18 UTC]
Try putting {} around the variable name..

 [2002-04-09 11:27 UTC] martijn at tiel dot nu
This looks to me like a serious bug not a request.

The only solutions is to set global_register to "on" which
ain't very save. (according the manual!).

What i'm trying to say is: YOU CAN'T PASS AN ARRAY ANYMORE!
unless ...
 [2002-04-09 11:33 UTC]
This works:
echo "{$HTTP_POST_VARS['personal']['name']}";
 [2002-04-09 11:33 UTC]
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. 

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Mar 31 13:03:39 2023 UTC