in reply to need to increment a $scalar while inside for loop
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:
Later, when it comes to accessing the variables sent from the form, transfer them to a hash: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 ); }
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 ;-)
|
|---|