firstly...
make sure your HTML file contains the following form action and any fields you are interested in sit between the opening <form> and closing </form> tags
[blue]<FORM ACTION="
METHOD="GET">
<input type="text" name="???">
<input type="text" name="???">
<input type="text" name="???">
<input type="hidden" name="hiddenfield" value="?????">
</form>[/blue]
secondly...
upload the following script to your cgi-bin - saved as 'duncmail.pl' and set the permissions to be able to execute
change the red bit to your email address - DO NOT REMOVE THE BACKSLASH BEFORE THE @ SIGN
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<HTML>\n<HEAD>\n<TITLE>Duncan Carr - Form Parser</TITLE>";
print "\n</HEAD>\n<BODY>";
$ENV{'QUERY_STRING'} =~ s/&Submit=Submit//;
$ENV{'QUERY_STRING'} =~ tr/+/ /;
$ENV{'QUERY_STRING'} =~ s/%(..)/pack("c", hex($1))/eg;
print "<h1>Duncan Carr - Form Parser</h1>\n\n";
@pairs = split (/&/, $ENV{'QUERY_STRING'});
foreach $pair (@pairs) {
($field, $value) = split (/=/, $pair);
$formdata{$field} = $value;
print "<li>$formdata{$field} => $value\n";
}
open (MAIL, '| /usr/sbin/sendmail -t');
print MAIL "From: Duncan Carr -> form parser\n";
print MAIL "To: [red]you\@whateverisp.com[/red]\n";
print MAIL "Cc:\n";
print MAIL "Bcc:\n";
print MAIL "Subject: form submission\n";
# body...
foreach $pair (@pairs) {
($field, $value) = split (/=/, $pair);
print MAIL "$field => $value\n\n";
}
close MAIL;
kind regards
Duncan