FW: [PHP] Variable Next To Variable?

From: Date: Wed, 11 Jul 2001 17:29:22 +0000
Subject: FW: [PHP] Variable Next To Variable?
Groups: php.general 
Request: Send a blank email to php-general+get-57443@lists.php.net to get a copy of this message
What I'm doing is having a form page ask, "How many children do you want to sign up?" Then it spits out form fields for as many children as they asked for. So each field has name="C_Last_Name$x" and $x in incremented for each child. Should I make it name="C_Last_Name[$x]" ? Jeff Oien > 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 > > > > -- > 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 >

« previous php.general (#57443) next »