Andrew Gaffney [mailto:[EMAIL PROTECTED] 
: 
: I have a Perl script which uses the CGI module which needs to 
: be able to get all the 
: selected items in a SELECT. I see that the request comes in as 
: 'selectname=item1&selectname=item2&selectname=item3'. If I do 
: '$p = $cgi->Vars', wouldn't 
: I only get the last value?

    In a quick test, I get a hash reference:

#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper 'Dumper';

use CGI;
my $cgi = CGI->new( \*DATA );

my $p = $cgi->Vars;

print Dumper \$p;

__END__
selectname=item1
selectname=item2
selectname=item3


prints:
$VAR1 = \{
            'selectname' => 'item1 item2 item3'
          };


    Why use $cgi->Vars?

#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper 'Dumper';

use CGI;
my $cgi = CGI->new( \*DATA );

my @p = $cgi->param( 'selectname' );

print Dumper [EMAIL PROTECTED];

__END__
selectname=item1
selectname=item2
selectname=item3


prints:

$VAR1 = [
          'item1',
          'item2',
          'item3'
        ];


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to