Very nice solution. Thank you !

Plutarck schrieb:

> If the variable's names will be $Name1, $Name2, etc, then you'd do something
> like this:
>
> for ($i = 1, $i <= $n)
> {
> /* $n will be how many variables you have. So if you have 5 variables, $n
> should equal 5 */
> ${"Name" . $i} = $default_value;
> }
>
> So if $n was 3 and $default_value was 0, you'd have three variables who's
> value was 0:
> $Name1
> $Name2
> $Name3
>
> Variable variables are the way to go. They're so cool :) I wonder if Java
> has anything like that...
>
> Plutarck
>
> "Martin Thoma" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hello !
> >
> > I want to make a dynamic formular, on which the user can enter a
> > different number of names.
> > So to make the form I do:
> >
> > for ($i = 0; $i < $anzahl; $i++)
> >  { printf ("<INPUT TYPE=\"TEXT\" NAME=\"Name%.0d\" VALUE=\"\"
> > SIZE=20\">\n", $i);
> >  }
> >
> > Now I want to set all the Varables Name0, Name1, Name2 etc. to a
> > default-value.
> > How can I do it in a for-next-loop ?
> >
> > Regards
> >
> > Martin
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to