Thanks very much for the response Randy. It looks like you are right, somewhere $serial is not getting defined since this is exactly what is being submitted to the DB after using print: update address set name_first = 'asdf', name_last = 'Watson', address_01 = '123 Golf Course Lane', address_02 = 'Suite A', address_city = 'Macon', address_state = 'GA', address_postal_code = '31066' where serial = ;
It doesnt look like there are any spelling mistakes that I can tell, but maybe another pair of eyes will find something that I missed. The script for updating a DB entry is below. I can post up the rest of the scripts involved as well if you think it necessary. Thanks again for the help, its greatly appreciated!!!
#!/usr/bin/perl
#--------------------------------------------------------------------------
# edit_save.pl
#--------------------------------------------------------------------------
use DBI;
use DBD::mysql;
use CGI qw(:standard);
use LWP::UserAgent;
my $Database = "perltest2";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
$buffer =~ tr/+/ /;
$buffer =~ s/\r/ /g;
$buffer =~ s/'/ /g;
$buffer =~ s/\n/ /g;
$buffer =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$buffer =~ s/<!--(.|\n)*-->/ /g;
$buffer =~ tr/\\|[|]|<|!|"|$|{|}|*|#|'|>|||;|%/ /;
@pairs = split(/&/,$buffer);
foreach $pair(@pairs){
($key,$value)=split(/=/,$pair);
$formdata{$key}.="$value";
}
$serial = $formdata{'serial'};
$name_first = $formdata{'name_first'};
$name_last = $formdata{'name_last'};
$address_01 = $formdata{'address_01'};
$address_02 = $formdata{'address_02'};
$address_city = $formdata{'address_city'};
$address_state = $formdata{'address_state'};
$address_postal_code = $formdata{'address_postal_code'};
$dbh = ConnectToMySql($Database);
$query = "update address set name_first = '$name_first', name_last = '$name_last', address_01 = '$address_01', address_02 = '$address_02', address_city = '$address_city', address_state = '$address_state', address_postal_code = '$address_postal_code' where serial = $serial";
$sth = $dbh->prepare($query);
$sth->execute();
$sth->finish();
$dbh->disconnect;
print header;
print <<HTML;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitiona$
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<body>
<center>
<center><font color=blue>My Addresses - <a href=http://ipaddress/cgi-bin/dashboard.pl>Dashboard</a></font><p>
The following information was updated:<p>
<table>
<input type=hidden name=id value="$serial">
<tr><td align=right>Name First </td><td>$name_first</td></tr>
<tr><td align=right>Name Last </td><td>$name_last</td></tr>
<tr><td align=right>Address 1 </td><td>$address_01</td></tr>
<tr><td align=right>Address 2 </td><td>$address_02</td></tr>
<tr><td align=right>City </td><td>$address_city</td></tr>
<tr><td align=right>State </td><td>$address_state</td></tr>
<tr><td align=right>Zip </td><td>$address_postal_code</td></tr>
</table>
HTML
exit;
#----------------------------------------------------------------------
sub ConnectToMySql {
#----------------------------------------------------------------------
my ($db) = @_;
# open(PW, "<..\/accessSM") || die "Can't access login credentials";
my $db= perltest2;
my $host= localhost;
my $userid= username;
my $passwd= password;
chomp($db);
chomp($host);
chomp($userid);
chomp($passwd);
my $connectionInfo="dbi:mysql:$db;$host";
# close(PW);
my $l_dbh = DBI->connect($connectionInfo,$userid,$passwd);
return $l_dbh;
}