Hi JJJ777,
If you have your sequence in place the number will automatically be place in the postgres table when you execute the insert. After creating the transaction, I immediately select the transaction from the table and display it complete with the new auto incremented number for the user that filled out the form, just to let him/her know the update was successful. The primary unique key in this example is the cno field.
You might try something like:
############################### Connect to the database.
##############################
$dbh = DBI->connect
("DBI

g:dbname=$the_db;host=$the_host", $the_user,
$the_pass_wd, {'RaiseError' => 1});
$dbh->do("INSERT INTO smorders
(date_it,first,last,company,address,city,state,postal,phone,
email,pass_key,payby,cardtype,cardholder,cardnumber,cardmont
h,cardyear,amount,processed) VALUES
('now',$lfirst,$llast,$lcompany,$laddress,$lcity,$lstate,$lp
ostal,$lphone,$lemail,$lpass_key,$lpayby,$lcardtype,$lcardho
lder,$lcardnumber,$lcardmonth,$lcardyear,$lamount,$lprocesse
d)"

;
############################################################
$sth = $dbh->prepare("SELECT currval
('smorders_cno_seq')"

;
$sth->execute;
$array_ref = $sth->fetchall_arrayref();
foreach my $row (@$array_ref) {
@temp = @$row;
}
$leland=$temp[0];
##########################################################
$sth = $dbh->prepare("SELECT cno,first,last,company,email
FROM smorders WHERE cno=$leland AND first=$lfirst AND
last=$llast AND company=$lcompany AND email=$lemail"

;
$sth->execute;
############################################################
#####################
print "<html>";
print "<head>";
print "<title>Software - Master (TM)
Metacharacter</title>\n";
print "</head>";
print "<body TEXT='black' bgcolor='white'>";
print "<h3><B>";
print "<TABLE bgcolor=$the_color ALIGN='center'
cellpadding='0' cellspacing='0'
bordercolorlight=$the_borderlight
bordercolordark=$the_borderdark BORDER='7' WIDTH='100%'>\n";
print "<CAPTION><H1>Sales Order Update</H1></caption>";
print "<TR bgcolor=$headcolor> $thetitle</TR>";
$array_ref = $sth->fetchall_arrayref();
foreach my $row (@$array_ref) {
@$therow = @$row;
print sprintf "$thesprintf", @$therow;
}
$dbh->disconnect();
print "</TABLE>";
if ($leland>0) {
print "<h3><b>Enter the registration number below
into your program.</b></h3>\n";
print "<H1>$factor</H1>";
print "<h3><b>Thank You\! Your Card Has Passed
Validation. It will now be submitted for Charge
Authorization.</b></h3>\n";
print "</body>\n</html>\n";
# Remember mail to purchaser
&send_mail;
# Remember mail to Seller
&send_mailx;
} else {
print "<h3><b>Your Submission did not update our
database. Please go <FONT COLOR='\#FF0000\'>Back</font>
and resubmit your order. Thanks.</b></h3>\n";
print "</body>\n</html>\n";
}
exit;
Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox