So when i add a post the timestamp doesnt work, but when i edit a post it updates it to the correct time/date.
Here is my addPost code:
addPost.php:
<?php include(‘includes.php’); ?>
<!DOCTYPE html>
<head>
<title>QSS - admin area</title>
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="admin.css" type="text/css" media="all">
</head>
<body>
<div class="wrapper">
<span>Logged in! Welcome <?php echo $_SESSION['user']; ?></span>
<a href="logout.php">Logout</a>
<ul class="topnav">
<li><a href="index.php">Home</a></li><li><a href="posts.php">Manage Posts</a></li><li><a href="cats.php">Manage Categories</a></li><li><a href="pages.php">Manage Pages</a></li>
</ul>
<div class="content">
<form action="doAddPost.php" method="post">
<label for="Postname">Name</label><br>
<input type="text" name="PostName" /><br>
<label for="PostAuthor">Author</label><br>
<input type="text" name="PostAuthor" /><br>
<label for="PostContent">Content</label><br>
<textarea name="PostContent"></textarea><br>
<input type="submit" value="Add" name="submit" />
</form>
</div>
</div>
</body>
</html>
My doAddPost.php file:
<?php
include('includes.php');
if(isset($_POST['submit'])) {
if(isset($_POST['PostName'])) {
if(isset($_POST['PostContent'])) {
addPost($_POST['PostName'],$_POST['PostAuthor'],$_POST['PostContent']);
header("Location: posts.php");
} else {
echo "Please enter some content!";
}
} else {
echo "Please set a post name" ;
include('addPost.php');
}
} else {
header("Location: addPost.php");
}
My addPost function:
function addPost($pName, $pAuthor, $pContent, $pDate) {
$query = mysql_query("INSERT INTO posts VALUES('','$pName', '$pAuthor', '$pContent', '$pDate')") or die(mysql_error());
}