:(
Here's what I use in my scripts to grab form input if it is any help:
#----------------------------------------------------------
# Return a hashref of all params and their values.
my ($INPUT) = {};
my (@INPUT) = ();
for (param()) {
@INPUT = param($_);
# Decide whether it is a single value or multiple.
if (@INPUT > 1) {
@{$INPUT->{$_}} = @INPUT
}
else {
$INPUT->{$_} = param($_)
}
}
return $INPUT;
}
I changed the sub name to get_data incase you want to try it.
Basically it detects whether the input is one value or multiple for each field and handles it appropriately.
So for your $data{my} field it would automatically put the data into an array ready for use.
The only thing you'd need to do to use it would be to add:
use CGI qw(:standard);
...to the top of the cgi script. The original code uses objects but I removed that so you don't need to bother creating one.
So basically you'd do:
my $input = get_data();
...and then hopefully you'll have access to the my field using @{$input->{my}}
Here's what I use in my scripts to grab form input if it is any help:
Code:
sub get_data { #----------------------------------------------------------
# Return a hashref of all params and their values.
my ($INPUT) = {};
my (@INPUT) = ();
for (param()) {
@INPUT = param($_);
# Decide whether it is a single value or multiple.
if (@INPUT > 1) {
@{$INPUT->{$_}} = @INPUT
}
else {
$INPUT->{$_} = param($_)
}
}
return $INPUT;
}
I changed the sub name to get_data incase you want to try it.
Basically it detects whether the input is one value or multiple for each field and handles it appropriately.
So for your $data{my} field it would automatically put the data into an array ready for use.
The only thing you'd need to do to use it would be to add:
use CGI qw(:standard);
...to the top of the cgi script. The original code uses objects but I removed that so you don't need to bother creating one.
So basically you'd do:
my $input = get_data();
...and then hopefully you'll have access to the my field using @{$input->{my}}