OK, in this script i have 2 sql statements. The first one will pull and echo the correct id which is $id. But when the if ($submit) statement is pulled it will not echo or read the id so therefore it will not update.
Any suggestions on this?
<?php
if ($Submit) {
$name = $HTTP_COOKIE_VARS['user'];
$con = mysql_connect("localhost","","i") or die(mysql_error());
$db = mysql_select_db("pinehead",$con) or die(mysql_error());
$sql = "UPDATE web SET subject = '$subject', body = '$body' WHERE id = '$id'";
mysql_query($sql,$con);
echo $sql;
// header("location: ");
mysql_close();
}
$name = $HTTP_COOKIE_VARS['user'];
$con = mysql_connect("localhost","","") or die(mysql_error());
$db = mysql_select_db("pinehead",$con) or die(mysql_error());
$sql = "SELECT * FROM web where id='$id' and user='$name'";
$result = mysql_query($sql,$con) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
$subject = $row['subject'];
$body = $row['body'];
$uname = $row['user'];
$_POST['id'];
$output = "<table border=0 cellpadding=0 cellspacing=0 width=90%>
<form action=".$PHP_SELF." method=post>
<tr>
<td>Subject:</td>
</tr>
<tr>
<td><input type=text name=subject value=".$subject."></td>
</tr>
<tr>
<td>Body</td>
</tr>
<tr>
<td><textarea cols=35 rows=15 name=body>".$body."</textarea></td>
</tr>
<tr>
<td><input type=submit value=Update name=Submit></td>
<td><a href=web.php>Cancel Changes</a></td>
</tr>
</form>
</table>";
?>
Thank you
Anthony