ok, so I have a perl form. It reads in an HTML template file. Right now i'm populating a drop down like so
HTML template:
<select name=s_dept onchange="sub_form('dept')">
<option>Choose Dept</option>
<TMPL_LOOP DEPT_LOOP>
<option><TMPL_VAR DEPT></option>
</TMPL_LOOP>
</select>
And then in my perl file I query a database, ... put that into an array. then
my @dept_loop;
foreach my $dept (@dept) {
push(@dept_loop, {DEPT => $dept});
%formparams = ( DEPT_LOOP => \@dept_loop, );<br>
# there are other elements i left out that are irrelvant.
then create my form after that... Anyway, that's all working fine. I populate the drop downs fine. But now I want to read 2 fields in from the database into a hash i suppose(ID and NAME). Populate the <option> tag with the NAME and the value="" parm with the ID. So, whatever they click I have the ID, submit the form. Then do a query to build the 2nd drop down. Select NAME2, ID2 from X where id = $id; Sound good? I'm just not sure what approach to take. I don't think I can use the TMPL_LOOP anymore. Maybe I can do everything in the perl file and just stick variables for the dropdowns in the HTML template. Some notes. I have to read in the template. I can't change it to be all the same file. I'd like to, cause it would be easier for me, but can't. I'm a perl newb, so keep that in mind too.