use DBI; $DSN = "dbi:Oracle:host=localhost;sid=essinv;port=1521"; $user = "username"; $pw = "password"; $dbh = DBI->connect($DSN,$user,$pw, { RaiseError => 1, AutoCommit => 1}) || die "Cannot connect: $DBI::errstr\n" unless $dbh; # get params & set variables my $employee_number = &filter(param('employee_number')); my $last_name = &filter(param('last_name')); my $first_name = &filter(param('first_name')); print header (); eval{ $SQL = "INSERT INTO EMPLOYEE ( EMPLOYEE_NUMBER, FIRST_NAME, LAST_NAME, INFORMATION_DATE) VALUES ('$employee_number', '$last_name', '$first_name', SYSDATE)"; $sth = $dbh->prepare($SQL); }; # End of eval # Check for errors. if($@){ $dbh->disconnect; print "Content-type: text/html\n\n"; print "An ERROR occurred! $@\n
"; exit; } else { $sth->execute; } # End of if..else ## Filter - Gets rid of characters that screw up the program. sub filter{ $_[0]=~s/\'/\\\'/g; return $_[0]; } # End of filter subroutine # Disconnect from the database $sth->finish; $dbh->disconnect;