I'm writing a blog system:
write.php
<html>
<body>
<h1>FooBlog V.01</h1>
<h2>Write a Blog entry:</h2>
<form name='input' method='post' action='write.php'>
<p>Name: <input type='text' name='name' id='name' /></p>
<p>Title: <input type='text' name='title' id='title' /></p>
<p>Blog Entry:</p>
<textarea name="content" id='content' rows="25" cols="100"></textarea>
<p><input type='reset' name='reset' value='reset' /> <input type='submit' name='submit' value='submit' /></p>
</form>
<?php
/* Blog System
Before running, make sure you have a MySQL DB called 'blog' with a table like this in it:
CREATE TABLE posts(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT ,
postTitle CHAR( 255 ) ,
PostDate CHAR( 255 ) ,
PostAuthor CHAR( 255 ) ,
PostContent TEXT
);
*/
/* MySQL Connection */
$mysql_connect = mysql_connect("localhost", "root", "usmce7");
if ($mysql_connect) {
;
}
else {
die("Failure to connect with MySQL");
}
/* Connecting to Database */
$oscms_db_connect = mysql_select_db("blog");
if ($oscms_db_connect) {
;
} else {
die("Failure to connect with database");
}
if (isset($_POST['submit'])) {
echo "Request Submited.<br />";
$name = $_POST['name'];
$title = $_POST['title'];
$content = $_POST['content'];
$time = time();
$post = mysql_query("INSERT INTO posts (postTitle, postDate, postAuthor, postContent) VALUES ('$title', '$time', '$name', $content));");
if ($post) {
echo 'Post saved succesfully';
} else
echo "Post not saved.";
}
?>
When I run it, I get no 'offical' PHP error, but my script out puts:
Request Submitted
Post not saved
And no data is submitted to the table.
Any help?