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.

In reply to some advice... by djbryson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.