View Full Version : How to make a comment form?
03-21-2009, 03:02 AM
Hi everyone! I would like to know what I need to put a comment box on my webpage which is sorta like a blog but it doesn't have a link where people can post comments after each entry.
I'd like to make the comment box similar to what blogspot has where someone can fill in their information (e-mail, homepage, etc) and post comments that will appear under the blog entry. I've searched all over google and still do not know what is required other than setting up a mysql database to store the comments. If anyone has any experience with this or any helpful information to share I'd greatly appreciate it!
Thanks in advance:)
03-21-2009, 01:49 PM
If you are just looking to see what's required, basically I'd say just a MySQL database ad the PHP script to add/view the comments.
What you will need to consider though, is how to link the comments to the blog post. Is it third party software or self made? Either way, you'll need to see how the blogs are identified in the database (usually an id of some sort), and make a field for that in the comment table to identify the comments with the blog itself.
Hope that helps
03-22-2009, 03:08 AM
It does depend on what system you are using for your blog. If you use your own just ensure that when your form is submitted it also includes the blog post's ID number for your mySQL database. You could do it any number of ways, this is one easy one:
<form action='myCommentScript.php' method='post' enctype='text/plain'>
<input type='hidden' name='myBlogPostIDNumber' value='<?php echo( $thisPostsIDNumber ); ?>' />
<input type='text' name='myFunCommentLine' />
<input type='submit' value='Submit!' name='submit' />
Then read in the $_POST['myBlogPostIDNumber'] on your PHP page. CAUTION: If you use this method be sure to validate that this post actually exists in your database before storing them comment. Someone could utilize XSS and change the value of that hidden field to something malicious.
Hope this gives you some more guidance.
03-22-2009, 06:49 AM
I came across the Scripts Mill comment script but I have not installed it yet. On the demo page (http://www.scriptsmill.com/comments_demo.html) it says I need to have SSI: <!--#include virtual="/comments/comments.php" --> on every page that I want to have the comments system included. I do not understand what Server Sides Includes do. Please let me know what this means. Does this mean I need to insert that code on the bottom of each blog entry when I am coding so people can be able to comment on my posts?
I am not using a blog but am setting up a web page that has blog entries similar to an actual blog, but it does not have a comments system yet.
Thanks for the advice everyone!:thumbsup:
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.