$id = $_GET['id'];
if (!$id)
{
echo "Please select a news article to edit. Thanks!";
}
else if ($id)
{
if ($_POST['go'])
{
$error = "";
if (!$_POST['title'])
{
$error = "Title cannot be blank!";
}
if (!$_POST['name'])
{
$error .= "
Autor cannot be blank!";
}
if (!$_POST['message'])
{
$error .= "
You fogot to enter a message!";
}
if ($error)
{
echo $error;
}
else
{
$title = $_POST['title'];
$author = $_POST['author'];
$post = $_POST['message'];
$query = mysql_query("UPDATE `news_posts` SET `title` = '$title', `author` = '$author', `post` = '$post' WHERE `id` = $id");
if ($query == TRUE)
{
echo "News Post Has Been Updated!";
}
else
{
echo "News post could not be updated.";
}
}
}
}
$query = mysql_query("SELECT * FROM `news_posts` WHERE `id` = '$id' LIMIT 1");
while ($r=mysql_fetch_assoc($query))
{
$title = $r['title'];
$author = $r['author'];
$post = $r['post'];
echo "