Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1

$Vendor_Name = $postInputs{'Vendor_Name'};


$Address = $postInputs{'Address'};


$Address2 = $postInputs{'Address2'};


$State = $postInputs{'State'};


$City = $postInputs{'City'};


$Zip = $postInputs{'Zip'};


$Phone = $postInputs{'Phone'};


$E_Mail = $postInputs{'E_Mail'};


$URL = $postInputs{'URL'};


$Contact = $postInputs{'Contact'};


$dbh->do("INSERT INTO Vendors


VALUES(NULL, '$Vendor_Name', '$Address',


'$Address2', '$City','$State', '$Zip', '$Phone', '$E_Mail',


'$URL, '$Conact')");


$dbh->disconect;



Subroutine that gets the post from the previous


#form and puts the values #


into an associative array


sub readPostInput{


my (%searchField, $buf, $pair, @pairs);


if ($ENV{'REQUEST_METHOD'} eq 'POST'){


read(STDIN, $buf, $ENV{'CONTENT_LENGTH'});


@pairs = split(/&/, $buf);

Free download pdf