Hi, every body,
I am a novice perl user, tyring to write some CGI scripts in Perl to maintain some
database on the webserver.
I have a table called test in mydb database with the following field structure ( I am
using Postgresql 6.5.2 under Redhat Linux 6.2):
firstname char(10)
lastname char(10)
dob date
balance float
I so far have the following code in perl:
__________________________________________________________________________________
#!/usr/bin/perl -w
use CGI qw(:standard :netscape :shortcuts);
use DBI;
my $q= new CGI;
my $dbh=DBI->connect('dbi:Pg:dbname=mydb');
my $first = $q->param("first");
my $last = $q->param("last");
my $dob = $q->param(��dob��);
my $balance = $q->param(��balanace��);
my $sql = "INSERT INTO test(fname, lname, dob, balance)
VALUE (��������������������������������������������������)
$dbh->do($sql);
$dbh->disconnect;
print end_form;
print hr;
print end_html
____________________________________________________________________________
Intention here is to:
1. assign all data received from HTML form into scalar variables, $first, $last,
$dob and $balance, using param().
2. and then insert those values into test table.
I guess I have so far managed to assigned the data received from HTML form into
designated scalar variables, but I have no idea how I can use them to insert into
table.
Any tips/pointers to this problem would be appreciated.
Damar