#!/usr/bin/perl use DBI; use DBD::ODBC; use CGI qw( :all ); use CGI::Carp qw( fatalsToBrowser ); print "Content-type: text/html\n\n"; $the_db="vfp2pg"; $the_table="example1"; $the_host="localhost"; $the_user="VfP2Pg"; $the_pass_wd="HelloWorld"; sub do_main { ##perl streams an HTML form here to the client's ##browser. When the client clicks on the submit ##button, this perl script is called by the "Action ##Post" which directs input from the form to ##sub do_update(). The do_update sub is called like: &do_update(); } sub do_update { $findrec="cno=".$FORM{'cno'}; $lcno=$FORM{'cno'}; $lfirst="'".$FORM{'first'}."'"; $llast="'".$FORM{'last'}."'"; $ldate_it="'".$FORM{'date_it'}."'"; $lcompany="'".$FORM{'company'}."'"; $laddress="'".$FORM{'address'}."'"; $lcity="'".$FORM{'city'}."'"; $lstate="'".$FORM{'state'}."'"; $lpostal="'".$FORM{'postal'}."'"; $lphone="'".$FORM{'phone'}."'"; $lemail="'".$FORM{'email'}."'"; $lpass_key="'".$FORM{'pass_key'}."'"; $lpayby="'".$FORM{'payby'}."'"; $lcardtype="'".$FORM{'cardtype'}."'"; $lcardholder="'".$FORM{'cardholder'}."'"; $lcardnumber="'".$FORM{'cardnumber'}."'"; $lcardmonth="'".$FORM{'cardmonth'}."'"; $lcardyear="'".$FORM{'cardyear'}."'"; $lamount=$FORM{'amount'}; $lprocessed="'".$FORM{'processed'}."'"; $the_update="UPDATE $the_table SET first=".$lfirst.",last=".$llast.",company=".$lcompany, ",address=".$laddress.",city=".$lcity.",state=". $lstate.",postal=".$lpostal.",phone=".$lphone. ",email=".$lemail.",pass_key=".$lpass_key.", payby=".$lpayby.",cardtype=".$lcardtype.", cardholder=".$lcardholder.",cardnumber=".$lcardnumber.", cardmonth=".$lcardmonth.",cardyear=".$lcardyear.", amount=".$lamount.",processed=".$lprocessed.", thetime=datetime() WHERE cno=".$lcno; ### print #the_update; ## Uncomment for debugging ############ Connect to the Database ########### $dbh = DBI->connect('dbi:ODBC:vfp1'); $dbh->{autocommit} = 0; # enable transactions, if possible $dbh->{RaiseError} = 1; eval{ $sth = $dbh->prepare($the_update or die "Can't prepare the update statement: $DBI::errstr"); $sth->execute or die "Can't execute update: $DBI::errstr"; $dbh->commit; # commit the changes if we get this far }; if ($@) { print "Transaction aborted because $@"; $dbh->rollback; # undo the incomplete changes # add other application on-error-clean-up code here if( defined($dbh) ) { $dbh->disconnect(); } } else { print "<html>"; print "<head>"; print "<title>The example record updated successfully</title>\n"; print "</head>"; print "<body TEXT='black' bgcolor='white'>"; print "<h3><B>"; print "<BR><BR>Your example update was successful. Please "; print "use your <FONT COLOR=\"\#FF0000\">Back</font> button to continue. "; print "</h3><B>"; print "</body></html>"; } } exit;Regards,