Re: Iterating varibales

From: Date: Thu, 05 Jul 2001 21:58:33 +0000
Subject: Re: Iterating varibales
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-56393@lists.php.net to get a copy of this message
One solution $HTTP_POST_VARS['input_field'.$inc]; ----- Original Message ----- From: "Brian Ricks" <airlinkw@yahoo.com> To: <php-general@lists.php.net> Sent: Thursday, July 05, 2001 3:08 PM Subject: [PHP] Iterating varibales > I have a site which uses two pages. The first page generates an HTML > form with multiple rows which is then POSTed to the second page. Sometimes > on the first page I have to create multiple rows of INPUT fields. To allow > a dynamic number of INPUT fields (say someone wants to add seven new numbers > to there online address book), set up a while look and echo "<INPUT > TYPE=text NAME=input_field".$inc.">"; where $inc is the incremented variable > in a loop. The result is something like this: > > <INPUT TYPE=text NAME=input_field0> > <INPUT TYPE=text NAME=input_field1> > <INPUT TYPE=text NAME=input_field2> > > The difficulty comes when I try to access these variables on the second > page. Currently I am using a script like this: > > $String = 'input_field'.$inc; > echo($$String); > > Sometimes my code requires multiple variables and conditions. When this > happens, using the above code is confusing a lengthy. Is there a way to > simplify this code at all? > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > -- > 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 _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

« previous php.general (#56393) next »