I'm having a problem with a PHP/MySQL news script I'm making. I will post the script here. It contains a Post News page and a News Posted page which inserts it into MySQL.
//postnews.php
<html>
<head>
<title>Post News</title>
</head>
<body bgcolor="black" text="red">
<?php
$db = mysql_connect("localhost");
mysql_select_db("News");
?>
<form action="newsposted.php" method="POST">
Date: <input type="text" name="date"><br>
Title: <input type="text" name="title"><br>
Author: <input type="text" name="author"><br>
News: <textarea rows="10" name="news" cols="40"></textarea>
<br>
<input type="submit" name="action" value="submit">
</form>
</body>
</html>
//newsposted.php
<html>
<head><title>News Posted</title></head>
<body bgcolor="black">
<font color="white">
<?php
//create short variable names
$title = $HTTP_POST_VARS['title'];
$author = $HTTP_POST_VARS['author'];
$news = $HTTP_POST_VARS['news'];
$date = $HTTP_POST_VARS['date'];
$con = mysql_connect;
$select = mysql_select_db("news", $con);
if(!$title || !$author || !$news || !$date)
{
echo 'You have not filled out all required fields.<br />
Please go back and try again.';
exit;
}
$title = addslashes($title);
$author = addslashes($author);
$news = addslashes($news);
$date = addslashes($date);
$select
$query = "insert into news values ('".$title."', '".$author."', '".$news."', '".$date."')";
$result = mysql_query ("$query");
if ($result)
{
echo 'News posted.';
}
?>
</font>
</body>
</html>
PLEASE HELP ME!!!