How are you determining which option to pre-select? It might be better to use HTML::FillInForm.
Other than that, here's what you would do if you want to re-invent the wheel:
### In your programming code ###
my $template = HTML::Template->new( 'filename' => 'file.TMPL' );
my $occloop_ar = []; # occupation loop array ref.
while ( my ( $option, $value ) = $sth->fetchrow_array ) {
my $selected = 0;
$selected = 1 if i_want_this_option_selected( $option );
push @$array_ref, {
'VAL' => $option,
'TEXT' => $value,
'SELECTED' => $selected,
};
}
$template->param( 'OCCUPATION_LOOP' => $occloop_ar );### Then in your template code ###
Occupation: <select name="occupation">
<TMPL_LOOP NAME=OCCUPATION_LOOP>
<option value="<TMPL_VAR NAME=VAL>" <TMPL_IF NAME="SELECTED">SELECTED</TMPL_IF>><TMPL_VAR NAME=TEXT></option>
</TMPL_LOOP>
Cheers,
Jason
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users
