So, what’s left? We need to provide the backend for what happens when a user types in a comment. We will simply take the form input and insert it in the comments table. Then, provide a link back to the page they came from.
<?php function addComment($id) { global $db;
/* insert the comment */ $query = "INSERT INTO news_comments " . "VALUES('',$id,'{$_POST['name']}'," . "'{$_POST['comment']}')"; mysql_query($query);