RE: [PHP] Variable Next To Variable?
| From: | scott [gts] | Date: | Wed, 11 Jul 2001 17:02:31 +0000 |
| Subject: | RE: [PHP] Variable Next To Variable? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57425@lists.php.net to get a copy of this message | ||
you should change the form field names to
$Children_Last[1], $Children_Last[2]
instead of hardcoding $Children_Last1
to make iteration thru the form easier
and handling of the data easier...
you can handle it all like this:
$Number_Children = 5;
$i = $Number_Children;
while ($i--) {
if (! $Children_Last[$i]) {
// code
}
}
> -----Original Message-----
> From: Jeff Oien [mailto:jeff@webdesigns1.com]
> Subject: [PHP] Variable Next To Variable?
>
>
> Sorry if this has been brought up 100 times.
> I want to do this:
>
> $y = "1";
>
> while ($y <= "$Number_Children") {
> if (!$C_Last_Name$y) {
> error stuff;
> $y++;
> }
> }
>
> The form submitting information to this code has field name like
> C_Last_Name1 C_Last_Name2 depending on how many Children
> are signing up for something. So I need $y to represent the number.
>
> Hope that makes sense. Thanks for any help.
> Jeff Oien
>
> --
> 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
>