in reply to Need help in inserting records in MySQL

First see this on formatting your code, like this:
$dbh->do("insert into registration (donorssn,donordob,regdt,donorname,password, question,answer,email,phone) VALUES($ssn,'$dob','$x','$dname','$pwd', '$question','$ans','$email','$ph')"); if(!$dbh) { $err = "Error:" . $dbh->errstr . "\n"; } else { $err = " Thank you for registering online Please contact the Oklahoma Blood Institute at 1-800-827-5693 for more information"; $rpath = "/obi/register.html"; }
You should not be checking the status of $dbh, which should always be a valid database handle after connecting, you should be checking the return value of $dbh->do(...), like so:
my $status = $dbh->do(....); if ($status) { # OK } else { # Error }
Also look at the DBI documentation (and What are placeholders in DBI, and why would I want to use them?) and consider using placeholders/bind values so that you don't have to worry about quoting your arguments or escaping quotes that users might feed you as input. You won't get any efficiency gain in MySQL, but its still a worthwhile thing to do.