I am trying to code a comment system where I can leave comments on all pages. Every page has its own id.
I would like a comment box where I can add and see other comments already posted.
This is my code thus far:
db table
`id` INT AUTO_INCREMENT,
`page_id` INT NOT NULL,
`comment_content` TEXT,
`timestamp` TIMESTAMP NOT NULL DEFAULT NOW(),
PRIMARY KEY (`id`)
form
<form name="comment_content" action="addcomment.php" method="post">
<input type="hidden" id="page_id" value="$page_id" />
<textarea id="content"></textarea>
<input type="submit" />
</form>
addcomment.php
<?
$page_id = $_POST['page_id'];
$comment_content = $_POST['comment_content'];
mysql_query('INSERT INTO `comment` (`page_id`, `comment_content`) VALUES('.$page_id.', "'.$comment_content.'");
?>
Can anyone help me with this?