So I have a comment post thingy for my blog I've made, but it doesn't seem to be inserting the data. Here's the form:
<form action='' method='post' name='postComment'>
<label for='name'>Name:</label><br/><input type='text' id='name' name='name''/><br/>
<label for='comment'>Comment:</label><br/><input type='text' id='comment' name='comment' />
<br/><input type='submit' value='Post' name='postComment'/></form></div>
The form is processed on the same page in the top part of the page. I use the same way of inserting the data as the blog posts themselves so I know it works. I've also tested the SQL by using phpMyAdmin (obviously removing placeholders)
if(!empty($_POST['postComment']))
{
$date = date("d/m/y g:i:A");
$name = clean(mysqli_real_escape_string($db, $_POST['name']));
$comment = clean(mysqli_real_escape_string($db, $_POST['comment']));
if ($stmt = $db->prepare("INSERT INTO `comments` (`name`, `comment`, `entry`, `date`) values (?, ?, ?, ?)")) {
$stmt->bind_param('ssis', $name, $comment, $_GET['id'], $date);
$stmt->execute();
$stmt->close();
}
}
Any help would be appreciated, been scratching my head over this one for a day now.