$dbHandle = DBI->connect('DBI:mysql:mydb','ID','pw'); #### my $dbh = DBI->connect("DBI:mysql:database=dbname;host=host", "$id","$pw") || die "Can't connect: $DBI::errstr"; #### #!/usr/bin/perl -wT use strict; use CGI qw( :standard ); use CGI::Carp qw( fatalsToBrowser ); use DBI; use DBD::mysql; #Store each field in a variable. my $name = param("name"); my $phone = etc.. my $age = etc.. my $sth; #Then insert each of them into a table: $sth = $dbh->prepare("INSERT INTO userdata VALUES (?,?,?)"); $sth->execute($name, $phone, $age); #Make sure you clean up when finished: $sth->finish(); $dbh->disconnect();