#start table template my $sTemplate='......'; #generate table rows foreach my $iRow (0... $#loopData) { #generate field definitions qualified by row id # e.g. FNAME_$iRow # LNAME $iRow # CHECKBOX $iRow # append field definitions to row fields push @aFields, @aRowFields; # generate a template string using the above fieldnames $sTemplate .= "......"; } #finish table $sTemplate='INSERT_NEW_RECORD_HERE
'; #write template string out to a temp file #generate form using the temp file my $oForm = CGI::FormBuilder->new( fields => \@aFields, ... template => 'tmpForm.tmpl' ); $oForm->render();