Quackit Logo
HTML
CSS
Scripting
Database
Hosting
Design
XML

Print Version

Add Comments to Website

If you've seen the HTML comment box code page, you'll know how to create a comment box.

Although that page demonstrates how to create a comment box, it assumes one thing: that you have an action page to process the contents of the comment box when the user clicks the "Submit" button.

What's an "Action Page"?

An action page is a page/script that takes the contents of your form, and does something with them.

For example, this action page sends you an email whenever anyone submits their feedback. Another action page could take the comments from your comment box, insert them into a database, then display them your web page.

To create an action page, you need to be reasonably well-versed in a scripting language such as PHP or ColdFusion.

The action page will require different code depending on what exactly you need to do. For example, you might want to implement security measures to check that the comment doesn't look like spam. You might want to check that the form was in fact submitted from your website. You might also want to check the length of your users' comments etc.

Add Comments the Easy Way!

You might have realized that writing an action page is not necessarily a simple thing. Because of this, there are many free scripts available on the web that you can download for your website.

JS-Kit Comments would be one of the easiest ways to add a comments section to your website. All you need to do is copy/paste two lines of JavaScript code. That's it! Once you've uploaded your web page, the comments section will be displayed whereever you placed the code.

Here's an example of what you get when you use JS-Kit comments. All I did to get the following comment section is add the following two lines of code. Note that I used the 'paginate' attribute to avoid to many comments on one page. I also used the 'backwards' attribute to ensure that the most recent comments appear at the top.

Code:

Copy/paste this code into your website:

Result:

The above code results in the following comments section:

The biggest advantage of JS-Kit Comments is its ease of use (and it's free!). The disadvantage of using a service like this is that, you have less control over what your script does with your users' comments. Having said that, you can customize your comments section to a certain degree.

Ultimately, it's up to you about whether to create your own script or not. You could also consider downloading a pre-made guestbook script, such as this one from Matt's Script Archive.

Enjoy this website?

  • Share
  • Add this page to your Favorites
  • Link to this page (copy/paste into your own website or blog):
  • Link to Quackit using one of these banner ads.
  • Help support Quackit by making a donation

Oh, and thank you for supporting Quackit!

© Copyright 2000 - 2010 Quackit.com