In article <56313003.1006216242@[10.0.0.140]>, [EMAIL PROTECTED] (Birgit Kellner) wrote:
> I have tried the following code to read a query-string from a CGI request > into a hash, taking into account (a) multiple select fields without knowing > the field name, (b) getting rid of names without values, and thereby, > hopefully, (c) allowing for user input alternately through a text field or > a select list, (d) getting rid of select fields where no selection was > made, in which case the value will be "---". > > This is the code I used: > > #!/usr/bin/perl > use CGI qw(:standard); > use CGI qw(:cgi-lib); > my $q = new CGI; > my %in = &parse_form; #!/usr/bin/perl -w use strict; use CGI 2.78 qw(:standard :cgi-lib -no_xhtml); # if this errors, remove the 2.78 # what version of CGI.pm does your server have? print $CGI::VERSION, " CGI.pm installed\n"; my $q = new CGI; my $in = $q->Vars;# reference to hash print "Param 'foo' is ", $in->{'foo'}, "\n"; print "Multivalued param 'bar' contains "; my @bar = split("\0", $in->{'bar'}); print join "\n\t", @bar; print "\n"; print "Param 'baz' ", defined(param('baz')) ? " is ", $in->{'baz'}, "\n" : " is undefined\n"; -- Scott R. Godin | e-mail : [EMAIL PROTECTED] Laughing Dragon Services | web : http://www.webdragon.net/ It is not necessary to cc: me via e-mail unless you mean to speak off-group. I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]