
Help with redirecting HTML form input
Subject: Help with redirecting HTML form input
Date: Fri, 27 Jan 1995 21:15:05 GMT
writes:
Quote:
>I need help redirecting HTML form input into a database. I have a form
>that has several fields, and I have the data from the fields mailed to my
>mailbox. In the same form I also want the data to be directed into a
>database file for later manipulation.
>When I get my mail it looks like this
>from= joe
>comany= Anything, Inc.
>phone= 534-5673
>That's ok. But the data in the in database file looks exactly like
> the above mail example. I want the database file to fill up with
>ONLY the data that the user inputs, like as follows:
>joe
>anything, Inc.
>534-5673
Here's what I use to split the name/value pairs. It's a standard routine
adapted from the OReilly book _Managing Internet Information Services_.
The rest of my script does two things:
1) mails the form info to a mailbox at my site and a copy to the
respondee; and, 2) tab delimits the values and puts them into a database
file. If you'd like to see the whole thing, please email me directly.
Good Luck.
------------------------------------------------------
#check that POST method is used
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs on '&'
# Load the FORM variables
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
----------------------------------------------------
Yours,
Jeff Aldrich
University of Minnesota