Parseform question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Westonm
    New Member
    • Jul 2006
    • 1

    Parseform question

    I am using the subroutine parseform to parse out form input and insert it into a table. My service provider recently upgraded their server and probably software and I am now having a problem with several programs. Most I have been able to figure out but I still have one problem that is kicking my butt. On the entry form there are a couple of date fields where a user would enter something like 10/10/1944. When it gets parsed and inserted it becomes 10%2F10%2F1944. I think this is probably something in the parseform routing that is not recognizing the "/". The parseform I am using is:

    sub Parse_Form {
    if ($ENV{'REQUEST_ METHOD'} eq 'GET') {
    @pairs = split(/&/, $ENV{'QUERY_STR ING'});
    } elsif ($ENV{'REQUEST_ METHOD'} eq 'POST') {
    read (STDIN, $buffer, $ENV{'CONTENT_L ENGTH'});
    @pairs = split(/&/, $buffer);

    if ($ENV{'QUERY_ST RING'}) {
    @getpairs = split(/&/, $ENV{'QUERY_STR ING'});
    push(@pairs,@ge tpairs);
    }
    } else {
    print "Content-type: text/html\n\n";
    print "<P>Use Post or Get";
    }
    foreach $pair (@pairs) {
    ($key, $value) = split (/=/, $pair);
    $key =~ tr/+/ /;
    $key =~ 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 ($formdata{key} ) {
    $formdata{$key} .= ", $value";
    } else {
    $formdata{$key} = $value;
    }
    }
    }
    1;

    Does anyone have any ides how I can correct this?
Working...