php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
47 + 35 = ?
Subscribe to this entry?

 
 [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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-09 09:18 UTC] sniper@php.net
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 http://www.php.net/support.php
 [2002-04-09 09:18 UTC] sniper@php.net
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] sander@php.net
This works:
echo "{$HTTP_POST_VARS['personal']['name']}";
RTM!
 [2002-04-09 11:33 UTC] cynic@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 16:01:30 2024 UTC