All you do is have another array of tokens or for something a little more flash use a fields hash:
#!/usr/bin/perl use strict; use warnings; use CGI ':standard'; my %fields = ( abstract => [], enough => [], drop => [ 'foo', 'bar', 'baz' ] ); print header, start_html(), start_form, table({-border=>0}, Tr( {-align=>LEFT,-valign=>TOP}, [ td(['Email Address: ', textfield('usermail')]), format_input(%fields), td([ '', submit]), ]) ), end_form, hr; sub format_input { my %fields = @_; my @tds; for my $field ( sort keys %fields ) { if ( @{$fields{$field}} ) { my $list = popup_menu( -name => $field, -values =>$fields{$field}, ); push @tds, td([ ucfirst($field).': ', $list ]); } else { push @tds, td([ ucfirst($field).': ', textfield($field)]); } } return @tds; } my $tags =''; for my $token ( keys %fields ) { my $content = CGI::escapeHTML(param($token)); next unless $content; $tags .= qq!<meta name="token" content="$content"><br>\n!; } print $tags; print hr; print end_html();
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Re: Re: CGI aligning
by tachyon
in thread CGI aligning
by sulfericacid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |