Hi!  Gotta question.
I wrote this script to parse an html form that I have on localhost. I want
this script to be able to work on win_nt, win_2k servers (my site host) .
Please tear this script apart!  What would you do different?  What can I do
better?  I was told by some not to use $a and $b as variables, but it’s the
only way it worked.  Sorry, don’t know any better ;(
I want to send this script via email using Mail::Sendmail.  I know that my
host may already have this mod, but I want to learn how to use it for when I
host my site myself.  How do I incorporate that module into this script in
order to send the parsed output, in the format I have here, to my email
addr?

Thanks and have fun!
Nathan G.
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Code follows:

#!c:/perl/bin/perl -w

# PS: Tried to use:

#  use CGI qw(param);
# foreach $key (sort param()) {
#             print header;
#            print “<P><B>$key</B>:<U><B>”.param($key).”</B></P>”
# }

# and all it returned to me was a blank page.  Sooo….

use strict;
use CGI qw(param);
$a = new CGI;
$b = new CGI;

my ($who,$quote_type,$key,$phone,$email,$trt,$trl,$trh,$trw,
    $trc,$ac,$sd,$sc,$fr,$sl,$ns,$color,$cc,$ic,$tt,$spare,$oo,
            $adl,$adll,$city,$state,$zip);
$who = $a->param('firstname')." ".$a->param('lastname');
$quote_type = $b->param('submitButtoncattleman');
$phone = $a->param('phone');
$email = $a->param('emailAddr');
my ($sec,$min,$hours,$day,$month,$year) = (localtime)[0,1,2,3,4,5];

print "Content-type: text/html\n\n";
printf("At <B>%02d:%02d:%02d</B> on <B>%02d/%02d/%04d,</B><BR>",
$hours,$min,$sec,$month+1,$day,$year+1900);
print "<FONT size='6'><U><B>$who</U></B></FONT><BR>";
print "Phone number: <B>$phone</B><BR>";
print "Email Address: <B>$email</B><BR>";
print "submitted this quote request for a <BR><U><B><FONT
color='red'>$quote_type</FONT></B></U>:";
print "<HR align = 'left' noshade>";

$trt = $a->param('trailertype');
$trl = $a->param('trailerlength');
$trh = $a->param('trailerheight');
$trw = $a->param('trailerwidth');
$trc = $a->param('trailerconfig');
$ac = $a->param('axleconfig');

print "<FONT size = '5'><B>$trt</B></FONT><BR>\n";
print "Length: $trl<BR>\n";
print "Height: $trh<BR>\n";
print "Width: $trw<BR>\n";
print "GSN or BP: $trc<BR>\n";
print "Axles: $ac<BR>\n";
print "<HR width = '25%' align = 'left' noshade>\n\n";

print "<B><FONT size = '5'>Gate Options:</FONT></B><BR>\n";

$sd = $a->param('sidedoor');
$sc = $a->param('slider_center');
$fr = $a->param('full_rear');
$sl = $a->param('slantloads');
$ns = $a->param('num_slantloads');

print "Side Door: <B>$sd</B><BR>\n";
print "Center Sliders: $sc<BR>\n";
print "Full Rear Door: $fr<BR>\n";
print "Slant Loads: $sl<BR>\n";
print "Number of Slant Loads: $ns<BR>\n";
print "<HR width = '25%' align = 'left' noshade>\n\n";

print "<B><FONT size = '5'>Color Options:</FONT></B><BR>\n";

$color = $a->param('color');
$cc = $a->param('customcolor');
$ic = $a->param('insertcolor');

print "Color: <B>$color</B><BR>";
print "Custom Color: <B>$cc</B><BR>";
print "Trim Insert: $ic<BR>";
print "<HR width = '25%' align = 'left' noshade>\n\n";

print "<B><FONT size = '5'>Tire Options:</FONT></B><BR>\n";

$tt = $a->param('tiretypes');
$spare = $a->param('spare');

print "Tire Type: $tt<BR>\n";
print "Spare?: $spare\n";
print "<HR width = '25%' align = 'left' noshade>\n\n";

print "<B><FONT size = '5'>Other Options:</FONT></B><BR>\n";

$oo = $a->param('other_options');

print "$oo<BR>\n";
print "<HR width = '25%' align = 'left' noshade>\n\n";

print "<B><FONT size = '5'>Personal Information:</FONT></B><BR>\n";

$adl = $a->param('addrline1');
$adll = $a->param('addrline2');
$city = $a->param('city');
$state = $a->param('state');
$zip = $a->param('zip');

print "$who<BR>\n";
print "$adl<BR>\n";
print "$adll<BR>\n";
print "$city, $state<BR>\n";
print "Zip: $zip<BR>\n";
print "Phone: $phone<BR>\n";
print "Email: $email\n";

Reply via email to