In your cgi program that the form is calling, did you capture the notes value?
You cannot simply set "my $notes = $pnotes" because the value is the old one as
you said.
Have you try this?
$q = new cgi;
$notes = $q->param("notes");
-----Original Message-----
From: MCMULLIN, NANCY [mailto:[EMAIL PROTECTED]
Sent: Friday, February 18, 2005 11:21 AM
To: [email protected]
Subject: Can't save edited values to database
I'm attempting an edit screen in Perl with Oracle. I'm unable to figure
out how to keep the changed values so I can write to the DB. Can
anyone help? Here's part of my code:
===================
....
my $pt = param('t1'); # value retrieved from page before
...
my $dbh = DBI->connect("DBI:Oracle:sid", "uid", "pw",{AutoCommit=>1});
($pnotes) = $dbh->selectrow_array("SELECT notes FROM table WHERE t1 =
'$pt'");
...
Print "<form>";
print "<input type=text value=\"$pnotes\" name=notes>\n"; #user enters
new value here
print "<input type=submit name=edit value=' SAVE CHANGES '>\n"; # don't
know what to use to actually start the update statement below...
print "</form>\n";
my $notes = $pnotes;
my $sth = $dbh1->prepare("UPDATE table SET notes='$notes' WHERE t =
'$pt'") or die "Preparing: ", $dbh->errstr;
$sth->execute or die "Executing: ", $sth->errstr; # this is just
writing out the old values - not the new changes.
...
===================
Thanks!