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: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

##########################################################
#  Rick St Jean,
#  [EMAIL PROTECTED]
#  President of Design Shark,
#  http://www.designshark.com/
#  Quick Contact:  http://www.designshark.com/messaging.ihtml
#  Tel: 905-684-2952
##########################################################


-- 
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