Re: Why Arrays in Forms? ( Was "Accessing variables from a form" )
| From: | David Robley | Date: | Thu, 22 Feb 2001 00:23:22 +0000 |
| Subject: | Re: Why Arrays in Forms? ( Was "Accessing variables from a form" ) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41082@lists.php.net to get a copy of this message | ||
On Thu, 22 Feb 2001 08:24, Brian White wrote:
> That's the point - why do I have to have 'name="myArray[]"'. Why
> do I have to specify the '[]'s at all?
>
> Brian
>
> At 13:44 21/02/2001 -0800, jason cox wrote:
> >You don't have to specify them as "PHP arrays". You
> >can do something like:
> >
> ><input type=text name="myArray[]">
> ><input type=text name="myArray[]">
> ><input type=text name="myArray[]">
> ><input type=text name="myArray[]">
> >
> >PHP will create the array for you.
> >
> >Jason
>
> -------------------------
> Brian White
> Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
> Phone: +612-93197901
> Web: http://www.steptwo.com.au/
> Email: bwhite@steptwo.com.au
Because otherwise you have one variable name, and it will contain the
last value which was assigned to it.
I don't know any languages where you can do:
$value = 'A'
$value = 'B'
$value = 'C'
print $value
and get a result other than C
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA