Re: multidimensional array from html forms
| From: | Larry Linthicum | Date: | Fri, 05 Oct 2001 15:17:56 +0000 |
| Subject: | Re: multidimensional array from html forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70095@lists.php.net to get a copy of this message | ||
I know that enclosing form field names in [] makes them available as an
array
if the form were dynamically built like
PERSONS NAME (from database via $member_id )
<input type = hidden name = [data] value = $member_id> <input type = text
name = [data] >
next PERSONS NAME (from database via $member_id )
<input type = hidden name = [data] value = $member_id> <input type = text
name = [data] >
next PERSONS NAME (from database via $member_id )
<input type = hidden name = [data] value = $member_id> <input type = text
name = [data] >
etc
etc
I "think" I would then send an array containing all the $member_id (s) and
all the entries into the txt fields
first... am I correct in that?
second ... is the indexing order known and guaranteed? in other words is
$data[0] and $data[1] OR $data[12] and $data[13]
ALWAYS going to represent a "matched" pair? ( from "one line" of the
form } or is the indexing of the array subject to variation and may NOT be
in the same order as the [data] fields in the html ?????
What if nothing is entered into the txt field?
"Larry Linthicum" <larry@kimshew.com> wrote in message
news:20011005140851.20443.qmail@pb1.pair.com...
> Hi
> I just a PHP "hobbiest" trying to build a points calculating system for
> another hobby, please bear with me.
>
> I need to build a multidimensional array from a html form
> the array would look like:
>
> $needed_data = array (
> array (id = $member_id,
> points = $position ),
> array ( id = $member_id,
> points =$position),
> array (id=$member_id,
> points = $position);
>
> $member_id will be used to dynamically build the html form, $position
will
> be an integer entered into a text field in that form
> similar to this
>
> Fred($member_id=?) .. [ enter position=? ]
> John)$member_id=?) ......[enter position=?]
> etc
> etc
> [SUBMIT]
>
> IF ( I can get the data into an array like above) {
> I can make the rest of the script work }
>
> but that is a big "if" <G> ....... how can I stucture the form
> and get that multidimen array from the single name/value pairs passed from
> an html form?
>
>