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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: martijn at tiel dot nu
New email:
PHP Version: OS:

 

 [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-2022 The PHP Group
All rights reserved.
Last updated: Wed Jul 06 22:05:44 2022 UTC