Re: dymanic forms

From: Date: Tue, 06 Mar 2001 12:26:23 +0000
Subject: Re: dymanic forms
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42740@lists.php.net to get a copy of this message
Hi George! george wrote: > I am trying to build a form which can be geberated dynamically > by the user selecting the number of fields up to a max of 10. > just now i am using > if ($fields ==1){ > echo "<input type=text name=test>"; > } > elseif ($fields ==2){ > echo "<input type=text name=test>"; > echo "<input type=text name=test>"; You could use a 'for' structure to do that...like: for ($i=0; $i < $fields; $i++) { echo "<input type=text name=test[" . $i . "]>"; } The 'echo' line is different from yours so u can get each text value after the POST action. See you, -- Lucas Persona

« previous php.general (#42740) next »