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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kk at shonline dot de
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 14:01:27 2025 UTC