HI
Any help will be greatly appreciated.
The below statement is my parsing statement. It may be antiquated but it
works.
I want to process input from a select form that has two names and two name
values
name=group1 , value1=xxxx
name=group2 , value2=yyyy
IN the below statement, how do I process this information so that:
a] if a user selects both group1 and group2 from the drop lists, then it
will join them together and parse both groups as one.
b] if a user selects either group1 or group2 the it parses either group.
I have tried to use . for joining strings (concatenate)
################################
# parse form input
sub parse_form {
my(@pairs);
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
}
foreach $pair (@pairs) {
my($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([\a-fA-F0-9][\a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([\a-fA-F0-9][\a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
if ($name eq 'bgcolor' || $name eq 'background' || $name eq
'link_color' ||
$name eq 'vlink_color' || $name eq 'text_color' || $name eq
'alink_color' ||
$name eq 'title' || $name eq 'sort' || $name eq 'print_config'
||
$name eq 'return_link_title' || $name eq 'return_link_url' &&
($value)) {
$CONFIG{$name} = $value;
}
elsif ($name eq 'required') {
@required = split(/,/,$value);
}
elsif ($name eq 'exclude') {
@exclude = split(/,/,$value);
}
else {
if ($FORM{$name} && ($value)) {
$FORM{$name} = "$FORM{$name}, $value";
}
elsif ($value) {
$FORM{$name} = $value;
}
}
}
}
#######################################
William L Kolln
Email: [EMAIL PROTECTED]
##############################
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>