hi, um i am not sure why this is happening but , the id is passing to this page and into the from so that it can be edited, but when i submi the new info it comes up with an error saying that i have undefined variables ( the ones in the $sql update general statement, why is this, is it just that i dont know what i doing?....thanks for any help....
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("antiques",$db);
if (isset($id)) {
if (isset($submit)) {
$sql = "UPDATE general SET name='$name',description='$description',price='$price',image_name='$image_name', WHERE id=$id";
$result = mysql_query($sql);
echo "Thank you! Information updated.\n";
} else {
// query the DB
$sql = "SELECT * FROM general WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type=hidden name="id" value="<?php echo $myrow["id"] ?>">
Name:<input type="Text" name="first" value="<?php echo $myrow["name"] ?>"><br>
Description:<input type="Text" name="last" value="<?php echo $myrow["description"] ?>"><br>
Price:<input type="Text" name="address" value="<?php echo $myrow["price"] ?>"><br>
Position:<input type="Text" name="position" value="<?php echo $myrow["image_name"] ?>"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
}
} else {
$result = mysql_query("SELECT * FROM general",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href=\"%s?id=%s\">%s %s</a><br>\n", $PHP_SELF, $myrow["id"], $myrow["name"], $myrow["description"]);
}
}
?>
</body>