Hi quan,
A html form passes a string to a perl script as a single parameter. The string is delimeted into pairs. Each pair hold the name assigned to the input control and the input entered into the control by the user. For example, if I had two text controls named "firstname" and "lastname", and the user entered "Leland" into "firstname" and "Jackson" into "lastname" the string passed to perl would look something like:
firstname=Leland&lastname=Jackson
Perl captures this info into its buffer. Then perl needs to split the pairs out and assign them to variables. The following script show how a perl script can use the into passed from an html form.
read(STDIN, $buffer , $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# Stop people from using subshells to execute commands
# Not a big deal when using sendmail, but very important
# when using UCB mail (aka mailx).
$value =~ s/~!/ ~!/g;
# Uncomment for debugging purposes
# print "Setting $name to $value<P>";
$FORM{$name} = $value;
if ($value =~ /\<\!--\#(.*)\s+(.*)\s?=\s?(.*)--\>/) { &kill_input; }
if ($value =~ /[;><\*`\|]/) { &kill_input; }
}
Maybe this will give you some ideas about how you could do what you want.
Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox