RE: [PHP] Variables in variable names
| From: | Taylor, Stewart | Date: | Wed, 09 May 2001 11:30:48 +0000 |
| Subject: | RE: [PHP] Variables in variable names | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-52077@lists.php.net to get a copy of this message | ||
Yes!
Add '[]' to the end of the name.
This will inform php that all fields with that name should be put into an
array after submission.
e.g.
<FORM...
<INPUT TYPE="TEXT" NAME="name[]">
<INPUT TYPE="TEXT" NAME="name[]">
<INPUT TYPE="TEXT" NAME="name[]">
...
After submit php will have created an array called $name with 3 entries.
-Stewart
-----Original Message-----
From: seriousj [mailto:icjfm0@yahoo.com]
Sent: 09 May 2001 12:20
To: php-general@lists.php.net
Subject: Re: [PHP] Variables in variable names
The info is stored in the variables intitally by information entered by a
user on a webpage, can you have the browser store the info in an array and
have it passed by a form "post" command?
""Taylor, Stewart"" <Stewart.Taylor@uk.thalesgroup.com> wrote in message
news:2B25A9C95DC8D411BBE500508BB19239515CEB@ntslxch1.int.rdel.co.uk...
> Maybe an array would be more appropriate.
> e.g.
>
> $name[$i] =
> .
> .
>
>
>
>
> -Stewart
> -----Original Message-----
> From: seriousj [mailto:icjfm0@yahoo.com]
> Sent: 09 May 2001 12:09
> To: php-general@lists.php.net
> Subject: [PHP] Variables in variable names
>
>
> Hello,
>
> I need some help (newbie).
>
> I have some variable names with the form:
> $name_1
> $name_2
> $name_3
> $name_4...
>
> I want to access them by doing something like this:
> $i=0
> $name_$i
>
> This doesn't work, how do I include another variable in the name of a
> variable?.
>
> Cheers
> John
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net