php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #279 Multidimensional Arrays as Form Variables
Submitted: 1998-04-17 04:23 UTC Modified: 1999-09-12 20:57 UTC
From: kk at shonline dot de Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0 Release Candidate 3 OS: Solaris 2.5.1
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:
48 - 32 = ?
Subscribe to this entry?

 
 [1998-04-17 04:23 UTC] kk at shonline dot de
[ This has been informally submitted to the mailing list
  yesterday. -- KK ]

I can have

<input type="text" name="sem[326-436-02]" value="x">
<input type="text" name="sem[326-436-03]" value="y">

and have php return $sem as an array to me, if I chose to import my form
variables into the normal namespace.

I cannot have that with

<input type="text" name="sem[326-436-02][startdate]" value="x">
<input type="text" name="sem[326-436-03][enddate]" value="y">

and get a two dimensional array returned?

Instead, I get

key 326-185-01][sem_beginn value 16.02.1998

key 326-185-01][sem_ende value 20.02.1998

printed by the following code:

 function save_record($i) {
    global $sem;

    for (reset($sem); $i = key($sem); next($sem)) {
      printf("key %s  value %s<p>\n", $i, $sem[$i]);
    }
  }

and

    for (reset($sem[$i]); $j = key($sem[i]); next($sem[i])) {
      printf("key %s  value %s<p>\n", $j, $sem[$j]);
    }

explodes (with $i having the value "326-185-01") with an error

Warning: Variable passed to reset() is not an array or object in
/webpages/verwaltung/sem/details.php3
on line 240


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-20 20:06 UTC] jim at cvs dot php dot net
Moved to feature request.
 [1999-09-12 20:57 UTC] zeev at cvs dot php dot net
undoubtfully, the slowest bug report closure todate...  But hey,
it's done :)

PHP 4.0 Beta 3 or later supports multidimensional form variables.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC