Adding to the above,
please use CGI.pm to make your life a lot easier! And avoid the references - strict will not be happy and it's easy for typos to creep in.
Although you don't explain, I assume you want to be able to read the variables for processing afterwards, so using CGI.pm, here's an example snippet:
my $q = new CGI;
# let's assume the values creating the option html of $fname
# are stored in the array @fnames, and that the values 'GUEST'
# and 'Select a member' have been 'push'd onto the end.
for (0..$elements) {
$name_menu{$_} = $q->scrolling_list(-name => "M$_",
-values=>[@fnames],
-default=>['Select a member'],
-size=>1
);
}
Later, when it comes to accessing the variables sent from the form, transfer them to a hash:
my $i=0;
my %M;
while (my $val = $q->param("M$i") ) {
$M{$i} = $val;
$i++;
}
Then all Mi elements are accessable as $M{i}
Hope this is useful.
cLive ;-)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.