Re: dymanic forms
| From: | Rick St Jean | Date: | Tue, 06 Mar 2001 14:56:34 +0000 |
| Subject: | Re: dymanic forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42757@lists.php.net to get a copy of this message | ||
Use a for loop with
<?
for ($i=1; $i <= $fields ;$i++){
print("<input type=text name=test>");
}
?>
Or you can use a while loop with a counter... same thing.
At 12:17 PM 3/6/01 +0000, you 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>"; } elseif ($fields ==3){ echo "<input type=text name=test><br>"; echo "<input type=text name=test><br>"; echo "<input type=text name=test><br>"; } there must be a better way to do this TIA george -- 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########################################################## # Rick St Jean, # rstjean@internet.look.ca # President of Design Shark, # http://www.designshark.com/ # Quick Contact: http://www.designshark.com/messaging.ihtml # Tel: 905-684-2952 ##########################################################