PHP קוד:
if (isset($_GET["id"]))
{
$id= $_GET["id"];
}
if (isset($title)) //בדיקה אם קיימים נתונים במשתנים אלו דהיינו אם הם קיימים
{
$query = "UPDATE NEWS SET Author = '$author' where id=$id ";
$result = mysql_query($query);
if (!$result)
die ("Couldn't update:".mysql_error());
echo "<h1>Table updated ".mysql_affected_rows()." row(s) changed</h1><br>";
}
$result = mysql_query("SELECT * FROM NEWS where id = '$id' ");
$a_row=mysql_fetch_array($result);
echo "<form action='$PHP_SELF' method='POST'>\n";
echo "<input type='text' name='title' VALUE=".$a_row['Title'].">";
echo "The Title<P>";
echo "<input type='text' name='author' VALUE=".$a_row['Author'].">";
echo "Your Name<P>\n";
echo "<textarea rows=7 cols=25 name=\"content\">".$a_row['Content']."</textarea>\n";
print "<input type=\"submit\" value=\"submit!\"></form>\n";
mysql_close($link);