PDA

View Full Version : Getting paramters from HTML form


christopherbrag
01-18-2003, 04:01 AM
I would like for my perl script (cgi) to automatically get all parameters sent to it (by an HTML form) and turn them into variables so that:

param('NAME_HERE') along with all the other submitted parameters

would become $NAME_HERE

Id rather have the script do this automatically rather than specify something like this to turn each parameter into a variable:


$townname = param('townn');
$function = param('function');
$something = param('something');



Thank you, in advance.

chrisvmarle
01-18-2003, 12:30 PM
I used to use this to do that:


use CGI qw(:standard);

$query = new CGI;

@params = $query->param;
foreach (@params) {
$theparam =~ s/\///g;
$_ =~ s/\$//g;
$theparam = $query->param($_);
$theparam =~ s/\@/\\\@/g;
${$_} = $theparam;
}

Goodluck with it :D

Mzzl, Chris

christopherbrag
01-18-2003, 07:41 PM
Works great, thank you.