I'm having a form where a person can come in edit the information and then it using the POST function and it gets updated on the MySQL database. Now I do get confirmation that the data has been saved but it actually hasn't. I then put in the echo to display the variables and the $artist_id does not display. Any ideas? Thanks in advance.
<?php
//The Required Files to access the data base
require("../../includes/configs/config.cfg");
require("../../includes/configs/select_db.cfg");
if(!IsSet($_POST['mybutton']))
{
$artist_id = $_GET['ID'];
$artist_admin_edit_sql = "SELECT * FROM artist WHERE ID =" .$artist_id;
$artist_admin_edit_results = mysql_query($artist_admin_edit_sql) or die(mysql_error());
$artist = mysql_fetch_array($artist_admin_edit_results);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form ACTION="admin_edit_artist.php?ID=<?php echo $artist_id; ?>" METHOD="POST" name="form1">
<table width="422" border="0" cellpadding="0" cellspacing="5">
<tr>
<td width="126"><font size="1" face="Arial, Helvetica, sans-serif">Artist ID: <?php echo $artist['ID']; ?></font>
</td>
<td width="131"><a href="da_artist_thumb.php?artist=<?php echo $artist['ID']; ?>">
<font size="1" face="Arial, Helvetica, sans-serif">View Artist's work</font></a></td>
</tr>
<tr>
<td width="122"><font size="2" face="Arial, Helvetica, sans-serif">Artist First Name </font>
</td>
<td width="290">
<input type="text" name="artistname" value="<?php echo $artist['artistname']; ?>">
</td>
</tr>
<tr>
<td><font size="2" face="Arial, Helvetica, sans-serif">Artist Last Name
</font>
</td>
<td>
<input type="text" name="artistlastname" value="<?php echo $artist['artistlastname']; ?>">
</td>
</tr>
<tr>
<td colspan="2">
<textarea name="artistbio" cols="50" rows="25">
<?php echo $artist['artistbio']; ?>
</textarea>
</td>
</tr>
</table>
<input type="submit" name="mybutton" value="update record">
</form>
<p> </p>
<p> </p>
</body>
</html>
<?php
//The Required Files to access the data base
require("../../includes/configs/config.cfg");
require("../../includes/configs/select_db.cfg");
}
elseif(isset($_POST['mybutton']))
{
$artist_id = $_POST['ID'];
$artist_firstname = $_POST['artistname'];
$artist_lastname = $_POST['artistlastname'];
$artist_bio = $_POST['artistbio'];
$artist_edit = "UPDATE artist SET ID = '', artistname = '$artist_firstname', artistbio = '$artist_bio', artistlastname = '$artist_lastname' WHERE ID = '$artist_id' LIMIT 1";
$artist_edit_action = mysql_query($artist_edit) or die(mysql_error());
if ($artist_edit_action==0)
{
echo "There has been a problem saving your information";
}
else
{
echo "Your information has been saved";
echo $artist_firstname;
echo $artist_lastname;
echo $artist_bio;
echo $artist_id;
}
}
?>