Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

PERL ASSIGNMENT

M.Sasireka
use
use
use
use

ADIT

CGI;
DBI;
win32::ODBC;
CGI::Carp "fatalsToBrowser";

$platform = "192.168.0.96\\SQLEXPRESS";
$database = "KWAP";
$user = "rapid";
$pwd = "rapid";
$dbstore = DBI ->
connect("DBI:ODBC:Driver={SQLServer};Server=$platform;Data
base=$database;UI=$user;PWD=$pwd");
$obj = new CGI;
$params = $obj->Vars;
$fname = $params -> {'fname'};
$lname = $params -> {'lname'};
$address = $params -> {'address'};
$phone = $params -> {'phone'};
$age = $params -> {'age'};
$sql_statement = ("INSERT INTO StudentDetails values
('$fname','$lname','$address',$phone,$age)");
$statementHandle = $dbstore ->prepare($sql_statement);
$statementHandle->execute() || die $statementHandle->errstr;
$statementHandle->bind_columns(undef,\$fname,\$lname,\
$address,\$phone,\$age);
if ($sql_statement)
{
$msg = 'Thank you for submit your details';
}
else
{
$msg = 'error';
}
print "Content-Type: text/html\n\n";

print qq~
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head><title>My Form Data</title></head>
<body>
<h2> message </h2>
<p>$msg</p>
</body>
</html>
~;

You might also like