So far this is the only code I have for now. I still dont have the code for comments.
=======
html
=======
<?php
include_once ('post_news.php');
?>
<form Action="add_news.php" Method="post">
<input name="postdate" type="text" id="postdate">
<input name="title" type="text" id="title">
<textarea name="newstext" cols="60" rows="15" id="newstext"></textarea>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset">
</form>
==============
php - post_news.php
==============
<?php
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
if (isset ($_POST['submit']))
{
require_once ('inc/dbConfig.php');
// Define the query.
$query = "INSERT INTO news (id, postdate, title, newstext) VALUES
(0,'{$_POST['postdate']}', '{$_POST['title']}','{$_POST['newstext']}')";
// Execute the query.
if (@mysql_query ($query)) {
print "<p>Data has been added.</p>";
} else {
print "<p>Could add the entry because: <b>" . mysql_error() . "</b>. The query was $query.</p>";
}
mysql_close();
}
?>
=====
db structure
======
id int(10) unsigned NOT NULL auto_increment,
postdate timestamp(14),
title varchar(50) NOT NULL,
newstext text NOT NULL,
PRIMARY KEY (id),
KEY postdate (postdate)
Thanks a lot for your help guys!