I am trying to write code for updating info in my database. I cannot get it to update but it is telling me it is.
I am passing the info from one page to another.
Page 1
mysql_select_db("artdb");
$search=$_GET["artid"];
//pulls info for Artist
$result = mysql_query("SELECT * FROM artist WHERE artid = '$search'");
while ($r=mysql_fetch_array($result))
{
$fullName=$r["fullName"];
$artid=$r["artid"];
//display the row
echo "<tr><td><form method=\"post\" action='artist3.php'></td></tr>\n";
echo "<input type=\"hidden\" name=\"artid\" value=\"$artid\"></td></tr>\n";
echo "<tr><td><h3>Art Id</h3></td><td><input type=\"text\" name=\"artid\" value=\"$artid\"></td></tr>\n";
echo "<tr><td><h3>Full Name</h3></td><td><input type=\"text\" name=\"fullName\" value=\"$fullName\"></td></tr>\n";
echo "<tr><td><input type=\"submit\" name=\"update\" value=\"Update\"></td></tr>\n";
echo "</form>\n";
}
Page 2
mysql_select_db("artdb");
$search=$_Post["update"];
$fullName=$_Post["fullName"];
$artid=$_Post["artid"];
//pulls info for Artist
$query = "UPDATE artist SET fullName = '$fullName' WHERE artid = '$artid' ";
$result = mysql_query($query) or die(mysql_error());
if ($result)
{
echo "<h2>Information changed.</h2>\n";
}
else
{
echo "<h2>Sorry, I could not change the information.</h2>\n";
}
?>
Any ideas?