CGI Perl



Add New Contact



Contact Database


Add New Contact





    Firstname
    Middle Initial
    Last Name
    Address
    Town
    Zip
    Phone
    e-mail
    Comments
    
    


//File: insertrec.pl
#!c:/perl/bin
use Win32::OLE;
use Win32::OLE::Const 'Microsoft ActiveX Data Objects';
use CGI ':standard';
print header();
$firstname = param("firstname");
$lastname  = param("lastname");
$middle    = param("middle");
$street    = param("street");
$town      = param("town");
$postcode  = param("postcode");
$phone     = param("phone");
$email     = param("email");
$comments  = param("comments");
$table  = "contact_table";
$conn = Win32::OLE->new("ADODB.Connection");
$rs   = Win32::OLE->new("ADODB.Recordset");
$sql = "INSERT INTO $table (firstname, middle, lastname, street, town,postcode, telephone, email, comments)
        VALUES ('$firstname', '$middle', '$lastname', '$street', '$town','$postcode', '$phone', '$email', '$comments')";
$conn->Open("contact");
$conn->Execute($sql);
print "
Contacts Database
";
print "Record Added!
";
print "Add Another Contact?

";
print "Home

";
$rs->Close;
$conn->Close;