[htmltmpl] Select/option How to set "selected"?
Brought to you by:
samtregar
From: Mark F. <mar...@ea...> - 2004-05-03 20:57:23
|
I am creating a select list where all the "option" content comes from a mySQL table. The following works fine: ==================== Occupation: <select name="occupation"> <TMPL_LOOP NAME=OCCUPATION_LOOP> <option value="<TMPL_VAR NAME=VAL>"><TMPL_VAR NAME=TEXT></option> </TMPL_LOOP> ==================== How can I specify a row should be "selected"? The TMPL_VAR named "VAL" is a numeric index. If I could use TMPL_IF and concatenate the value of "VAL", I think it would work. <TMPL_IF NAME="SEL"<TMPL_VAR NAME="VAL">> selected </TMPL_IF> In my program I could set "$sel5 = 1". Is there any way to do this? Thanks, Mark |