Comment Form / Post Feedback Tutorial

Allow users to display and post comments on a page

Comment Form / Feedback Script Background

Feedback is very valuable to not only the web designers, but to other visitors as well. That was why I designed a simple comment form script for my site. I have had multiple requests for a tutorial on this, so I decided to write one. This is a fairly advanced tutorial, and I don't go into a lot of detail to explain my script. Now on to the tutorial...

Database: Create MySQL table

All the data from the comments form is stored in a MySQL database. If you do not have a database created, create one now. Now use the following MySQL command to create a new table to store the information:

CREATE TABLE `comments` (
  `commentid` int(11) NOT NULL auto_increment,
  `tutorialid` int(11) NOT NULL default '0',
  `name` text NOT NULL,
  `url` text NOT NULL,
  `comment` text NOT NULL,
  `email` text NOT NULL,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`commentid`),
  KEY `tutorialid` (`tutorialid`)
)

The script

1. Create a new php file, and name it "inc_rate.php". This file will store 5 functions: a date parsing script, a database connection function, a bbcode function, a function to display existing comments, and another to create an add comments form. Now add the following code to that page. You will need to input your database information at the top of the page. Explanations for the code are included as comments (in blue).




<?php
//Please set the following variables for your MySQL database:
//Please set the following variables for your MySQL database:
//it is highly recommended that you restrict access for the user for security reasons
//it only needs "INSERT" privileges

$db_hostname = "localhost";  //usually "localhost be default"
$db_username = "";  //your user name
$db_pass = "";  //the password for your user
$db_name = "";  //the name of the database


/*MYSQL DATABASE CONNECTION/ TRACKING FUNCTIONS
--------------------------------------*/
// connect to database
$dbh = mysql_connect ($db_hostname, $db_username, $db_pass) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($db_name);



//for security, html is not allowed, so bbcode is used for formatting

//START 3rd PARTY CODE:  I did not write this
/************************************************/
/*              BBCode v1.0a                    */
/*              Date: 03/2003                   */
/*                                              */
/*      A simple and effective script that      */
/*      allows you to implement bbcode type     */
/*      behaviour on your php website.          */
/*                                              */
/*      Contact: bbcode@netgem.freeserve.co.uk  */
/*                                              */
/*      Usage:                                  */
/*                                              */
/*      Put the following line at the top of    */
/*      the page you want to have the bbocde    */
/*      in...(assumes both pages are in the     */
/*      folder                                  */
/*                                              */
/*      include("bbCode.php");                  */
/*                                              */
/*      Pass the text to the function:          */
/*                                              */
/*      $mytext = BBCode("This is my BBCODE");  */
/*      or                                      */
/*      $mytext = "This is my text";            */
/*      $mytext = BBCode($mytext);              */
/*                                              */
/*      echo $mytext;                           */
/*                                              */
/************************************************/
?>
<style type="text/css">
<!--
body    {
        font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
}

.bold {
        font-weight: bold;
}

.italics {
        font-style: italic;
}

.underline {
        text-decoration: underline;
}

.strikethrough {
        text-decoration: line-through;
}

.overline {
        text-decoration: overline;
}

.sized {
        text-size:
}

.quotecodeheader {
        font-family: Verdana, arial, helvetica, sans-serif;
        font-size: 12px;
        font-weight: bold;
}

.codebody {
        background-color: #FFFFFF;
    font-family: Courier new, courier, mono;
    font-size: 12px;
    color: #006600;
    border: 1px solid #BFBFBF;
}

.quotebody {
        background-color: #FFFFFF;
    font-family: Courier new, courier, mono;
    font-size: 12px;
    color: #660002;
        border: 1px solid #BFBFBF;
}

.listbullet {
        list-style-type: disc;
        list-style-position: inside;
}

.listdecimal {
        list-style-type: decimal;
        list-style-position: inside;
}

.listlowerroman {
        list-style-type: lower-roman;
        list-style-position: inside;
}

.listupperroman {
        list-style-type: upper-roman;
        list-style-position: inside;
}

.listloweralpha {
        list-style-type: lower-alpha;
        list-style-position: inside;
}

.listupperalpha {
        list-style-type: upper-alpha;
        list-style-position: inside;
}
-->
</style>

<?php
        //Local copy

        function BBCode($Text)
            {
                // Replace any html brackets with HTML Entities to prevent executing HTML or script
            // Don't use strip_tags here because it breaks [url] search by replacing & with amp
            $Text = str_replace("<", "&lt;", $Text);
            $Text = str_replace(">", "&gt;", $Text);



            // Set up the parameters for a URL search string
            $URLSearchString = " a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'";
            // Set up the parameters for a MAIL search string
            $MAILSearchString = $URLSearchString . " a-zA-Z0-9\.@";

                        //Non BB URL Search
                        //$Text = eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "<a href=\"\\1://\\2\\3\" target=\"_blank\" target=\"_new\">\\1://\\2\\3</a>", $Text);
                //$Text = eregi_replace("(([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))", "<a href=\"mailto:\\1\" target=\"_new\">\\1</a>", $Text);
                if (substr($Text,0, 7) == "http://"){
            $Text = eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "<a href=\"\\1://\\2\\3\">\\1://\\2\\3</a>", $Text);
                 // Convert new line chars to html <br /> tags
            $Text = nl2br($Text);
                        } else {
            // Perform URL Search
            $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="javascript:go(\'$1\',\'new\')">$1</a>', $Text);
            $Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href="javascript:go(\'$1\',\'new\')">$2</a>', $Text);
                        //$Text = preg_replace("(\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text);
                         // Convert new line chars to html <br /> tags
            $Text = nl2br($Text);
                        }
            // Perform MAIL Search
            $Text = preg_replace("(\[mail\]([$MAILSearchString]*)\[/mail\])", '<a href="mailto:$1">$1</a>', $Text);
            $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.+?)\[\/mail\]/", '<a href="mailto:$1">$2</a>', $Text);

            // Check for bold text
            $Text = preg_replace("(\[b\](.+?)\[\/b])is",'<span class="bold">$1</span>',$Text);

            // Check for Italics text
            $Text = preg_replace("(\[i\](.+?)\[\/i\])is",'<span class="italics">$1</span>',$Text);

            // Check for Underline text
            $Text = preg_replace("(\[u\](.+?)\[\/u\])is",'<span class="underline">$1</span>',$Text);

            // Check for strike-through text
            $Text = preg_replace("(\[s\](.+?)\[\/s\])is",'<span class="strikethrough">$1</span>',$Text);

            // Check for over-line text
            $Text = preg_replace("(\[o\](.+?)\[\/o\])is",'<span class="overline">$1</span>',$Text);

            // Check for colored text
            $Text = preg_replace("(\[color=(.+?)\](.+?)\[\/color\])is","<span style=\"color: $1\">$2</span>",$Text);

            // Check for sized text
            $Text = preg_replace("(\[size=(.+?)\](.+?)\[\/size\])is","<span style=\"font-size: $1px\">$2</span>",$Text);

            // Check for list text
            $Text = preg_replace("/\[list\](.+?)\[\/list\]/is", '<ul class="listbullet">$1</ul>' ,$Text);
            $Text = preg_replace("/\[list=1\](.+?)\[\/list\]/is", '<ul class="listdecimal">$1</ul>' ,$Text);
            $Text = preg_replace("/\[list=i\](.+?)\[\/list\]/s", '<ul class="listlowerroman">$1</ul>' ,$Text);
            $Text = preg_replace("/\[list=I\](.+?)\[\/list\]/s", '<ul class="listupperroman">$1</ul>' ,$Text);
            $Text = preg_replace("/\[list=a\](.+?)\[\/list\]/s", '<ul class="listloweralpha">$1</ul>' ,$Text);
            $Text = preg_replace("/\[list=A\](.+?)\[\/list\]/s", '<ul class="listupperalpha">$1</ul>' ,$Text);
            $Text = str_replace("[*]", "<li>", $Text);

            // Check for font change text
            $Text = preg_replace("(\[font=(.+?)\](.+?)\[\/font\])","<span style=\"font-family: $1;\">$2</span>",$Text);

            // Declare the format for [code] layout
            $CodeLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="quotecodeheader"> Code:</td>
                                </tr>
                                <tr>
                                    <td class="codebody">$1</td>
                                </tr>
                           </table>';
            // Check for [code] text
            $Text = preg_replace("/\[code\](.+?)\[\/code\]/is","$CodeLayout", $Text);

            // Declare the format for [quote] layout
            $QuoteLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="quotecodeheader"> Quote:</td>
                                </tr>
                                <tr>
                                    <td class="quotebody">$1</td>
                                </tr>
                           </table>';

            // Check for [code] text
            $Text = preg_replace("/\[quote\](.+?)\[\/quote\]/is","$QuoteLayout", $Text);

            // Images
            // [img]pathtoimage[/img]
            $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '<img src="$1">', $Text);

            // [img=widthxheight]image source[/img]
            $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.+?)\[\/img\]/", '<img src="$3" height="$2" width="$1">', $Text);

                return $Text;
                }


//END 3rd PARTY CODE

//quick script to make the data look nice
function formatDate($val)
  {
      list($date, $time) = explode(" ", $val);
      list($year, $month, $day) = explode("-", $date);
      list($hour, $minute, $second) = explode (":", $time);
      return date("l, m.j.y @ H:ia", mktime($hour, $minute, $second, $month, $day, $year));
  }



function getComments($tutid){
//creates a function that can easily be called from any page

//create the css code to make the form look good.  You can edit this to change colors, etc:
echo "
<style>
/*COMMENTS
*------------------------------------*/

.postedby {
        padding: 0 0 0 18px;
        background: url(images/abullet.gif) no-repeat 0 4px;
        }
        
h3.formtitle {
        margin : 0px 0px 0px 0px;
        border-bottom: 1px dotted #ccc;
        padding-bottom: 8px;
        }

.commentbody {
        border-top: 1px dotted #ccc;
        }
        
/*gray box*/
.submitcomment, #submitcomment, #currentcomments, #rating, .textad {
        background-color: #F5F5F5;
        border: 1px dotted #ccc;
        padding: 5px;
        padding: 5px;
        margin: 20px 0px 0px 0px;
        }


/*FORMS
*------------------------------------*/

.form {
        background-color: #FAFAFA;
        border: solid 1px #C6C6C6;
        padding: 2px;
        }

.formtext {
        background-color: #FAFAFA;
        border: solid 1px #C6C6C6;
        padding: 2px;
        border-bottom: 1px dotted #ccc
        }

.form:hover, .formtext:hover {
        background: white;
        }
        
.form:focus, .formtext:focus {
        background: white;
        border: solid 1px #000000;
        }
        
.submit {
        background-color: #D3D3D3;
        border: solid 1px #C6C6C6;
        border-right:  solid 1px #9A9A9A;
        border-bottom:  solid 1px #9A9A9A;
        }
        
.submit:hover, .submit:focus {
        background: #EDEDED;
        }
        </style>

        
        ";
//fetch all comments from database where the tutorial number is the one you are asking for
        $commentquery = mysql_query("SELECT * FROM comments WHERE tutorialid='$tutid' ORDER BY date") or die(mysql_error());
//find the number of comments
        $commentNum = mysql_num_rows($commentquery);
//create a headline
        echo "<div id=\"currentcomments\" class=\"submitcomment\"><h3 class=\"formtitle\">Current Comments</h3>\n";
        echo $commentNum . " comments so far (<a href=\"#post\">post your own</a>)\n";
//for each comment in the database in the right category number...
        while($commentrow = mysql_fetch_row($commentquery)){
//for security, parse through the bbcode script
//the number corresponds to the column (the message is always stored in column 4
//COUTING STARTS at 0!!!
        $commentbb = BBCode($commentrow[4]);
//create the right date format
                $commentDate = formatDate($commentrow[6]);

                echo "<div class=\"commentbody\" id=\"$commentrow[0]\">\n
                <p>$commentbb</p>\n
                <p class=\"postedby\">Posted by ";
                if($commentrow[3]){
                echo "<a href=\"$commentrow[3]\">$commentrow[2]</a> ";
                } else {
                echo "$commentrow[2] ";
                }
                echo "on $commentDate | #$commentrow[0]</p>\n
                \n</div>";

        }
        echo "</div>";
}

function submitComments($tutid2,$tuturl){
//a javascript script to make sure all the required fields are filled in
?>
<script language="javascript">

function form_Validator(form)
{

  if (form.name.value == "")
  {
    alert("Please enter your name.");
    form.name.focus();
        return (false);
     }

  if (form.message.value == "")
  {
    alert("Please enter your message.");
    form.message.focus();
    return (false);
  }
  
  return (true);
  }
  //-->
  </script>
<?php
//create the form to submit comments
//you can add more fields, but make sure you add them to the db table and the page, submitcomment.php
        echo "
<a name=\"post\">
<div id=\"submitcomment\" class=\"submitcomment\">
<form name=\"submitcomment\" method=\"post\" action=\"submitcomment.php\" onSubmit=\" return form_Validator(this)\">
<table width=\"100%\">
                <tr>
                                <th colspan=\"2\"><h3 class=\"formtitle\">Leave your comment:</h3></th>
                </tr>
                <tr>

                                <th scope=\"row\"><p class=\"req\">Name:</p></th>
                                <td><input class=\"form\" tabindex=\"1\" id=\"name\" name=\"name\" /></td>
                </tr>
                <tr>
                                <th scope=\"row\"><p class=\"opt\">Email:</p></th>
                                <td><input class=\"form\" tabindex=\"2\" id=\"email\" name=\"email\" /></td>
                </tr>
                <tr>

                                <th scope=\"row\"><p class=\"opt\">URL:</p></th>
                                <td><input class=\"form\" tabindex=\"3\" id=\"url\" name=\"url\" /></td>
                </tr>
                <tr valign=\"top\">
                                <th scope=\"row\"><p class=\"req\">Comments:</p><br /></th>
                                <td><textarea class=\"formtext\" tabindex=\"4\" id=\"message\" name=\"message\" rows=\"10\" cols=\"50\"></textarea></td>
                </tr>

                <tr>    
                                <td>&nbsp;</td>
                                <td><input type=\"submit\" name=\"post\" class=\"submit\" value=\"Submit Comment\" /><br />
                                <p>Note:  Emails will not be visible or used in any way, and are not required.  Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted. </p>

<p>No HTML code is allowed.  Line breaks will be converted automatically.  URLs will be auto-linked.  Please use BBCode to format your text.</p>

</td>
                </tr>
</table>
<input type=\"hidden\" name=\"tuturl\" value=\"$tuturl\" />
<input type=\"hidden\" name=\"tutid2\" value=\"$tutid2\" />
</form>


</div>
";
}
?>




2. Create another php file, and call it "submitcomment.php". This page will handle for form input and submit it to the database. Add the following code to that page. You will need to input your database information at the top of the page.


<?php
//Please set the following variables for your mysql database:
$db_hostname = "localhost";  //usually "localhost be default"
$db_username = "";  //your user name
$db_pass = "";  //the password for your user
$db_name = "";  //the name of the database


/*MYSQL DATABASE CONNECTION/ TRACKING FUNCTIONS
--------------------------------------*/
// connect to database
$dbh = mysql_connect ($db_hostname, $db_username, $db_pass) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($db_name);


$tuturl = $_POST["tuturl"];
$tutid2 = $_POST["tutid2"];
$name = $_POST["name"];
$url = $_POST["url"];
$email = $_POST["email"];
$message = $_POST["message"];

$sendcomment = mysql_query("INSERT INTO comments SET tutorialid='$tutid2', name='$name', url='$url', email='$email', comment='$message', date=now()");
if($sendcomment){
//header("Location: $tuturl");
echo "<h1>Submission Successful</h1>";
echo "Your comment has been submitted.  You will now be redirected back to the last page you visited.  Thanks!";
echo "<meta http-equiv='refresh' content='2;URL=$tuturl'>";
} else {
echo "There was an error with the submission. ";
}

?>


	

Finishing touches: Add to a page

Now we will add the submit comment form and display any exhisting comments to a page. Add the following code to your page where you want the comments to be displayed. Make sure the page is a php file.:

<?php
require('inc_rate.php');
getComments("1");
submitComments("1","$PHP_SELF");
?>

Replace "1" with a unique number for the page. For example, for this page, I use "22".

Tweaks

To order the list by newest posts first, find the line:

$commentquery = mysql_query("SELECT * FROM comments WHERE tutorialid='$tutid' ORDER BY date") or die(mysql_error());
And replace it with:
$commentquery = mysql_query("SELECT * FROM comments WHERE tutorialid='$tutid' ORDER BY date DESC") or die(mysql_error());

Final Code

If you are having any trouble, try downloading the script and tweaking it for your site. Here is all the final pages in a zip file:

commentscript.zip : 5 files

Hope this tutorial was useful. It is a fairly simple script, so adding fields, etc. should be easy. Have a great day!

Brian Zimmer is a graphics and web designer with over 4 years of experience in Paint Shop Pro, HTML, CSS, Javascript, SEO, PHP, and MySQL. His services include professional and affordable freelance web and graphic design. He is the webmaster of http://www.zimmertech.com, and you can contact him through email at brian@zimmertech.com.

Back to Top

Click here to return to ZimmerTech, or click here to view other tutorials.

Rate this Tutorial

Rate this Tutorial:

Current Rating:

1 out of 51.41/ 5.00 with 847 votes.

Current Comments

117 comments so far (post your own)

hi

Posted by lala on Thursday, 10.21.04 @ 06:34pm | #201

Nice tutorial!

Posted by Venom on Friday, 11.5.04 @ 10:39am | #207

Nice script!

I only miss one thing: the ability to use buttons to insert the BBcode...

Cheerz!

Posted by Freddy on Friday, 11.5.04 @ 01:55pm | #208

Testing

Posted by Testing on Friday, 11.5.04 @ 10:10pm | #209

great tutorial! a couple whishes:

1) I know it must be easy but i can't figure out how to manipulate the text font and size for the form. no matter what i tweak, "name, Email, & URL" look the same. any help on this?

2) any info on how to sort the entries by another field value? i want my form to be an event list. i would like to add a field for the event date and sort entries by that date...

thanks for the script.

Posted by ck on Wednesday, 11.24.04 @ 07:14pm | #226

The font size was in the CSS file. I changed the script to remove that line. It looks fine in Firefox, but I didn't realize it looked horrible in IE. For reference, you can remove the changed font size by removing the line "font-size: 70%;" in inc_rate.

To sort by another field value, at the end of the MySQL query where it ways "ORDER BY date", and change it to the new column that you created.

Posted by Brian Zimmer (http://www.zimmertech.com)on Wednesday, 11.24.04 @ 10:20pm | #227

Nice system :) great work. Very easy to use. Thank you!

Posted by DD on Sunday, 12.12.04 @ 11:24pm | #243

How do I create Database? thank you

Posted by John (don't have one)on Thursday, 12.16.04 @ 09:03pm | #248

Ok ,but I have that same comments in every page on my website. I want to create differend comments on every page...

Sorry for my english :/

Posted by mono on Saturday, 12.18.04 @ 09:56am | #249

If you want to have different comments on each page, change the number when you call the function. For example, on one page paste in:

<?php
require('inc_rate.php');
getComments("1");
submitComments("1","$PHP_SELF");
>

And for your next page, paste in:

<?php
require('inc_rate.php');
getComments("2");
submitComments("2","$PHP_SELF");
>

And so on.

Posted by Brian Zimmer on Wednesday, 12.22.04 @ 07:55pm | #250

cool!

Posted by cory on Thursday, 02.10.05 @ 12:19am | #351

Hi Nice Script..

Posted by Sathiyan (www.hashprompt.com)on Thursday, 02.10.05 @ 05:47am | #352

Excellent script. While testing it I posted some comments which I now want to remove. Any way to do this?

Posted by Michael on Monday, 02.21.05 @ 05:27pm | #362

To edit or remove comments, you have to edit the database. I use phpMyAdmin, which is installed on my server.

Posted by Brian Zimmer (http://www.zimmertech.com/)on Monday, 02.21.05 @ 05:43pm | #363

basically, I want to display in groups of 10. How do I do this? Do I have to manually create a new page every time it hits 10 or is there a way for it to automatically create a page such hat when I hit 11 comments, the first one automatically goes to the 2nd page and so on (and when it hits 21, the 1st comment goes to 3rd page, next ten on 2nd page, last 10 on first page, etc). Also, once I do that, how would I call each page?

Posted by Chau (phaseiipangroove.com)on Wednesday, 02.23.05 @ 06:24am | #368

I would like to write a script that reads through the comments searching for obscene words and replacing them with an appropriate word or asterixes. Can I do this? If so, how? Thank you again.

Posted by Chau (www.phaseiipangroove.com)on Thursday, 02.24.05 @ 07:08am | #370

Only testing

Posted by Jorge (www.watanabe.jor.br)on Saturday, 02.26.05 @ 09:44pm | #374

Hello, I have a website that I display my artwork on, and I've been looking for some kind of script that will let my friends and anyone who looks at my page leave a comment on a picture. This is the first script I have found that leaves the comment on the page, but I don't think my host supports PHP... is there a simpler way of just having a few text fields and a text box to allow comments to be left? Thank you!

Posted by Laura (http://www.freewebs.com/vanillapaint/)on Tuesday, 03.1.05 @ 10:06pm | #376

Hello, a have problem with this script

"Table 'gtdesign_uk_db.comments' doesn't exist "

help please

Posted by gtdesign on Sunday, 03.6.05 @ 12:48pm | #382

This means that the table in your database doesn't exhist. Run the following SQL command for your database:

CREATE TABLE `comments` (
`commentid` int(11) NOT NULL auto_increment,
`tutorialid` int(11) NOT NULL default '0',
`name` text NOT NULL,
`url` text NOT NULL,
`comment` text NOT NULL,
`email` text NOT NULL,
`date` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`commentid`),
KEY `tutorialid` (`tutorialid`)


)

Posted by Brian Zimmer on Tuesday, 03.8.05 @ 05:44am | #385

well.. i tried everything.. and it still wont work for me.. please help.. i get this error:

I cannot connect to the database because: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (46)

database information i use.. i'm pretty sure its correct... but its not working..
$db_hostname = "localhost"/;
$db_username = "aspkin"/;
$db_pass = "password"/;
$db_name = "mysql"/;

i uploaded all files, created the comments table.. help!

Posted by donny on Thursday, 03.10.05 @ 01:45am | #386

Hope this works well and I can incorporate it into my new site...

Posted by Jeremy Whittaker (www.ukpoet.com)on Friday, 03.18.05 @ 06:18pm | #418

looks like a cool script!

Posted by andre on Wednesday, 03.30.05 @ 04:45pm | #429

hi there! i was just wondering, how could i change the script to make the newest posts topmost?

thanks!

Posted by shaun (http://shaunh.com)on Thursday, 04.14.05 @ 09:16pm | #493

thanks for the tweak brian! :)

Posted by shaun on Saturday, 04.16.05 @ 03:07am | #494

can you do it WITHOUT php?

Posted by Katie (http://www.eonxl.net)on Tuesday, 04.19.05 @ 12:54am | #496

To make it easier to use maybe have a seperate .css file for it too.

Great work

Posted by fantastic on Tuesday, 04.19.05 @ 07:35pm | #498

Correct, it would be better to have a seperate css file. But for the sake of this tutorial, I tried to use as few files as possible.

Posted by Brian Zimmer on Wednesday, 04.20.05 @ 12:57am | #499

Excellent script.
For anyone who is interested a page to clear rows you don’t want from table.
On my website edgey.no-ip.com under useful links

Posted by mick (http://www.edgey.no-ip.com/)on Wednesday, 04.20.05 @ 05:01pm | #500

how do you change the font size and color ?

can somone helm me please

grtz wes

Posted by wesley on Saturday, 04.23.05 @ 02:31pm | #502

ja sam

Posted by dragan on Monday, 10.12.09 @ 06:18am | #7717

ja sam

Posted by dragan on Monday, 10.12.09 @ 06:18am | #7718

ja sam

Posted by dragan on Monday, 10.12.09 @ 06:19am | #7719

ja sam

Posted by dragan on Monday, 10.12.09 @ 06:19am | #7720

Testing it =)

Posted by hey on Monday, 10.12.09 @ 09:24pm | #7734

Posted by v ( )on Friday, 10.16.09 @ 01:44am | #7847

Posted by v ( )on Friday, 10.16.09 @ 01:44am | #7848

penis

Posted by penis on Saturday, 10.17.09 @ 03:10pm | #7868

After you decide on the general rolex type, you need to decide replica watches on the movement. The movement is basically the inner workings, there are three types/; quartz, mechanical and digital. A quartz watch uses a tiny vibrating crystal inside, these are very accurate. rolex watches Mechanical replica watches rely on springs and gears, these are quite expensive and not as accurate. The digital watch is battery powered, cheaper although considered a more casual style of fake rolex watch.When you decide to buy a watch which you are satisfied online replica watches, you may find cheaper one in replica rolex watches. Just pay attention to some great links right on this page . Sometimes you may find more from these links .

Posted by judy4121 (http://www.watchessell.com)on Sunday, 10.18.09 @ 07:03pm | #7880

After you decide on the general rolex type, you need to decide replica watches on the movement. The movement is basically the inner workings, there are three types/; quartz, mechanical and digital. A quartz watch uses a tiny vibrating crystal inside, these are very accurate. rolex watches Mechanical replica watches rely on springs and gears, these are quite expensive and not as accurate. The digital watch is battery powered, cheaper although considered a more casual style of fake rolex watch.When you decide to buy a watch which you are satisfied online replica watches, you may find cheaper one in replica rolex watches. Just pay attention to some great links right on this page . Sometimes you may find more from these links .

Posted by judy4121 (http://www.watchessell.com)on Sunday, 10.18.09 @ 07:05pm | #7881

After you decide on the general rolex type, you need to decide replica watches on the movement. The movement is basically the inner workings, there are three types/; quartz, mechanical and digital. A quartz watch uses a tiny vibrating crystal inside, these are very accurate. rolex watches Mechanical replica watches rely on springs and gears, these are quite expensive and not as accurate. The digital watch is battery powered, cheaper although considered a more casual style of fake rolex watch.When you decide to buy a watch which you are satisfied online replica watches, you may find cheaper one in replica rolex watches. Just pay attention to some great links right on this page . Sometimes you may find more from these links .

Posted by judy4121 (http://www.watchessell.com)on Sunday, 10.18.09 @ 07:05pm | #7882

After you decide on the general rolex type, you need to decide replica watches on the movement. The movement is basically the inner workings, there are three types/; quartz, mechanical and digital. A quartz watch uses a tiny vibrating crystal inside, these are very accurate. rolex watches Mechanical replica watches rely on springs and gears, these are quite expensive and not as accurate. The digital watch is battery powered, cheaper although considered a more casual style of fake rolex watch.When you decide to buy a watch which you are satisfied online replica watches, you may find cheaper one in replica rolex watches. Just pay attention to some great links right on this page . Sometimes you may find more from these links .

Posted by judy4121 (http://www.watchessell.com)on Sunday, 10.18.09 @ 07:05pm | #7883

seot tooka

Posted by 上海SEO (http://www.wingflo.com/seo/)on Wednesday, 10.28.09 @ 07:33pm | #8128

test test!

Posted by tester on Saturday, 10.31.09 @ 09:06am | #8262

test test!

Posted by tester on Saturday, 10.31.09 @ 09:06am | #8263

oi

Posted by oi on Saturday, 10.31.09 @ 02:34pm | #8264

oi

Posted by oi on Saturday, 10.31.09 @ 02:35pm | #8265

Excellent script! You saved me hours and hours of work. Thanks loads!

Posted by cars book value (http://www.book-value.co.za)on Monday, 11.2.09 @ 04:58am | #8328

thanks!

Posted by Ganesh S on Monday, 11.2.09 @ 06:35am | #8335

awefqwegfwergwerg
wergwergerg
ergerg
ergerg
rgergr
egergerg

Posted by h24trh4trh (wegfwegf)on Monday, 11.2.09 @ 10:36am | #8337

asdads

Posted by 31s on Tuesday, 11.3.09 @ 02:42pm | #8378

testing

Posted by tester on Sunday, 11.8.09 @ 01:42pm | #8529

adsdsadasfsdfasdffacaadcdssdffsdaHZHA

Posted by wwew (www.bg.bg)on Saturday, 11.14.09 @ 05:38am | #8717

Thanx....thx alot..!!
and...reply me if nythn more...

Posted by AfZal on Friday, 11.20.09 @ 09:35pm | #8951

Hi

Posted by Sam on Sunday, 11.22.09 @ 05:55am | #8972

Hi

Posted by Sam on Sunday, 11.22.09 @ 05:56am | #8973

Thanks for this i`m gonna try it...

Posted by Raul (http://migenteunida.com/)on Tuesday, 11.24.09 @ 10:05pm | #9020

Thanks for this i`m gonna try it...

Posted by Raul (http://migenteunida.com/)on Tuesday, 11.24.09 @ 10:06pm | #9021

testing

Posted by re (n)on Tuesday, 11.24.09 @ 11:13pm | #9023

on the page witch i called the script in too this comment box does not appears ....how do i know what i did wrong?

Posted by Mike on Wednesday, 11.25.09 @ 04:31pm | #9044

on the page witch i called the script in too this comment box does not appears ....how do i know what i did wrong?

Posted by Mike on Wednesday, 11.25.09 @ 04:31pm | #9045

test

Posted by blg on Tuesday, 12.1.09 @ 04:10am | #9322

Nice script.
thanks.

Posted by VigRX Plus (http://www.vigrxnplus.com)on Tuesday, 12.1.09 @ 05:15pm | #9340

Your blog has some fresh ideas that I have never seen in others’. I can learn a lot from them.

Posted by UGG Nightfall on Thursday, 12.3.09 @ 10:16am | #9448

s

Posted by ss (s)on Thursday, 12.3.09 @ 02:01pm | #9449

Thanks

Posted by yo on Saturday, 12.5.09 @ 02:04am | #9519

How can you

#1: Limit the amount of characters a person use in the comment box?

#2: eliminate users adding URLs in the box to avoid spam?

Thanks.

Posted by Ken on Monday, 12.7.09 @ 02:55pm | #9546

aaaaaaaaaaaa

Posted by aaa on Sunday, 12.13.09 @ 07:47pm | #9706

aaaaaaaaaaaa

Posted by aaa on Sunday, 12.13.09 @ 07:47pm | #9707

thnx!

Posted by kalamaras (www.xariskalamaras,gr)on Thursday, 12.17.09 @ 08:19am | #9778

hey
i done everything but when I open testpage.php all I see is

"Test Page
Here is the content..."

and nothing else? Am I making some kind of a mistake?
HELP

Posted by jaca on Friday, 12.18.09 @ 01:19pm | #9805

Get your free credit report here.

Posted by Tom Lopezz (http://www.freeannualcreditreportnow.com/)on Saturday, 12.19.09 @ 02:05am | #9818

Get your free credit report here.

Posted by Tom Lopezz (http://www.freeannualcreditreportnow.com/)on Saturday, 12.19.09 @ 02:06am | #9819

hi bro every this goes right i tried it and works out but one things my page is not redirect to the previous page where the comments had been posted ok reply me!!

Posted by sojal on Saturday, 12.19.09 @ 09:06am | #9821

hi bro every this goes right i tried it and works out but one things my page is not redirect to the previous page where the comments had been posted ok reply me!!

Posted by sojal on Saturday, 12.19.09 @ 09:06am | #9822

I tried using the script and it's working but the submitcomment.php cannot refresh. Please what do I do?

Posted by Chris on Monday, 12.21.09 @ 09:15am | #9854

asasasas

Posted by umair (asas)on Monday, 12.21.09 @ 10:49am | #9855

asasasas

Posted by umair (asas)on Monday, 12.21.09 @ 10:49am | #9856

testing :D

Posted by test@hack (unlimited-hacks.info)on Tuesday, 12.22.09 @ 12:48am | #9866

testing :D

Posted by test@hack (unlimited-hacks.info)on Tuesday, 12.22.09 @ 12:48am | #9867

help ...

can't post comments on my comment box ...

the following message appears ...

"Not Found

The requested URL /submitcomment.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."

the submitcomment.php is in the same folder of inc_rate.php ..

can u help me!?

thx

Posted by Henrique on Sunday, 12.27.09 @ 09:02am | #10015

a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74a8de74

Posted by fdg (dsdasad)on Monday, 12.28.09 @ 12:53am | #10032

checking comment

Posted by shubhra (www.easilyshopping.com/)on Monday, 12.28.09 @ 08:28am | #10042

Will this code works!!

Posted by Reverse Phone Lookup (http://www.goarticles.com/cgi-bin/showa.cgi?C=2392259)on Wednesday, 12.30.09 @ 02:13am | #10098

Will this code works!!

Posted by Reverse Phone Lookup (http://www.goarticles.com/cgi-bin/showa.cgi?C=2392259)on Wednesday, 12.30.09 @ 02:13am | #10099

Will this code works!!

Posted by Reverse Phone Lookup (http://www.goarticles.com/cgi-bin/showa.cgi?C=2392259)on Wednesday, 12.30.09 @ 02:14am | #10100

Hey Brian
First.. thankx a lot for the tutorial....

Just a couple of questions....

1) It worked for me. It is just that when i submit the comments and it goes to where it says submission sucessfull you will now be redirected to the page u where.. Nothing really happens... The only thing that happens is that that same webpage keeps on reloading going nowhere doing the same thing. I had to go back and check if the comment was actually submited.. Any thoughts?

2) When I tested the site in internet explorer.. when i hover the form.. the test where it says Name email url and comments goes blank and you have to kind of select it to be able to see what it reads in there... Any suggestion on this one? (By the way... when i check the submited posts the name of the person comes in blank too.. u have to select it or shade it to be able to see what it says in there)

Posted by Charles on Monday, 01.4.10 @ 08:43pm | #10159

ffffff

Posted by ggg (ffff)on Tuesday, 01.19.10 @ 09:52am | #10414

informative!!!!

Posted by andrea on Tuesday, 01.19.10 @ 10:48pm | #10415

blah blah blah

Posted by blah on Monday, 01.25.10 @ 09:55am | #10521

Nice script for my website......

Posted by Rohmat Hardi (yapp-akp.com)on Wednesday, 01.27.10 @ 12:00am | #10577

dafsd

Posted by asfd (dd)on Wednesday, 01.27.10 @ 10:25pm | #10583

An academic success always depends on good essay provided by <a href="http://www.essayscentre.com">custom essay writing</a> service. But your idea reffering to this good post supposes to be perfect also.

Posted by vr34Ruby (http://www.essayscentre.com)on Thursday, 01.28.10 @ 02:08am | #10589

cheap Tiffany &/; C<BR>cheap Christian louboutin<BR>discount Christian louboutin<BR>emporio armani watches for sale<BR>thomas wylde handbags<BR>loewe handbags for sale<BR>creative design<BR>tiffany rings<BR>Cheap Jordans Shoes<BR>

Posted by Tiffany Necklaces fake (http://www.mycostly.c)on Friday, 01.29.10 @ 01:11am | #10639

<a href="http://www.cmonc.com/category-163.html">wholesale COACH handbags</a>
<a href="http://www.cmonc.com/category-165.html">wholesale Prada handbags</a>
<a href="http://www.cmonc.com/category-58.html">wholesale JUICY handbags</a>
<a href="http://www.cmonc.com/category-487.html">wholesale Timberland boots</a>
<a href="http://www.cmonc.com/category-232.html">GUCCI boots</a>
<a href="http://www.asiahua.com">china wholesale</a>
<a href="http://www.asiahua.com/category-1.html">wholesale shoes</a>
<a href="http://www.asiahua.com/category-2.html">wholesale Clothing</a>
<a href="http://www.asiahua.com/category-7.html">wholesale Handbags</a>
<a href="http://www.cmonc.com/category-382.html">wholesale Puma shoes</a>
<a href="http://www.cmonc.com/category-287.html">wholesale Christian Audigier jeans</a>
<a href="http://www.cmonc.com/category-7.html">wholesale True Religion jeans</a>
<a href="http://www.cmonc.com/category-344.html">wholesale Ed hardy jeans</a>

<a href="http://www.sino-market.net/category-144.html">True Religion jeans</a>
<a href="http://www.sino-market.net/category-146.html">wholesale COOGI jeans</a>
<a href="http://www.sino-market.net/category-147.html">wholesale D G jeans</a>
<a href="http://www.sino-market.net/category-148.html">wholesale EVISU jeans</a>
<a href="http://www.sino-market.net/category-143.html">wholesale Affliction jeans</a>
<a href="http://www.sino-market.net/category-145.html">wholesale Ed Hardy jeans</a>
<a href="http://www.worldasea.com">china wholesale</a>
<a href="http://www.worldasea.com/category-1.html">wholesale shoes</a>
<a href="http://www.worldasea.com/category-2.html">wholesale Clothing</a>
<a href="http://www.worldasea.com/category-7.html">wholesale Handbags</a>
<a href="http://www.sino-market.net/category-389.html">Ed hardy Shirts</a>
<a href="http://www.sino-market.net/category-387.html">Christian Audigier Shirts</a>
<a href="http://www.sino-market.net/category-388.html">Abercrombie Fitch</a>
<a href="http://www.sino-market.net/category-321.html">wholesale north face</a>
<a href="http://www.sino-market.net/category-137.html">wholesale Timberland shoes</a>
<a href="http://www.sino-market.net/category-125.html">wholesale Air Jordan Shoes</a>



Posted by china wholesale (http://www.cmonc.com)on Friday, 01.29.10 @ 11:47pm | #10694

We run a professional website, it's your best choice, We have the best UGG, most stylish package, as well as the most professional NFL. <a href="www.purpleuggsonline.net">ladies UGG boots</a> are very popular, we sell <a href="www.uggonlinetrade.com">classic ugg boots</a> to you in low price, There are also very affordable <a href="www.uggladiesboots.com">UGG Australia sale</a>, In addition, our <a href="www.mybagshop.com">replica handbags</a> are in professional standards, <a href="www.nflluck.com">NFL shop</a> is your best choice ....

Posted by paul on Saturday, 01.30.10 @ 11:25am | #10701

how

Posted by me (nimetime.com)on Saturday, 01.30.10 @ 01:22pm | #10702

how

Posted by me (nimetime.com)on Saturday, 01.30.10 @ 01:24pm | #10703

Just tray..

Posted by Mba on Sunday, 01.31.10 @ 10:44am | #10717

I didn’t really see such kind of amazing theme related to this topic previously . Was this your 1st literary essays? I do guess that just only you and a <a href="http://www.essayscentre.com">writing service</a> could perform such kind of perfect outcome!

Posted by KonnieAa20 (http://www.essayscentre.com)on Tuesday, 02.2.10 @ 08:05am | #10740

Hi Brian Zimmer,
It is wonderful script and working for me. But couple of errors to be clarified. Please reply to implement this script on my website.

Error 1
After submission of comments the resulting page shows Submission successful and keep on reloads the same page forever and it is not redirecting to the previous page where comments have been submitted. Also for each auto refresh (error) it adding a blank row in the database and increasing number of rows. Except that the script is fine.

Error 2
Is there a way to stop vistor to submit number of comments from the same IP address?

It would be appreciated if you can clarify the doubt here so that all can benefit.

Regards
~ Ramakrihna

Posted by ramakrishna (www.coolgraphs.com)on Tuesday, 02.2.10 @ 11:54am | #10741

Hi Brian Zimmer,
It is wonderful script and working for me. But couple of errors to be clarified. Please reply to implement this script on my website.

Error 1
After submission of comments the resulting page shows Submission successful and keep on reloads the same page forever and it is not redirecting to the previous page where comments have been submitted. Also for each auto refresh (error) it adding a blank row in the database and increasing number of rows. Except that the script is fine.

Error 2
Is there a way to stop vistor to submit number of comments from the same IP address?

It would be appreciated if you can clarify the doubt here so that all can benefit.

Regards
~ Ramakrihna

Posted by ramakrishna (www.coolgraphs.com)on Tuesday, 02.2.10 @ 11:54am | #10742

Hi Brian Zimmer,
It is wonderful script and working for me. But couple of errors to be clarified. Please reply to implement this script on my website.

Error 1
After submission of comments the resulting page shows Submission successful and keep on reloads the same page forever and it is not redirecting to the previous page where comments have been submitted. Also for each auto refresh (error) it adding a blank row in the database and increasing number of rows. Except that the script is fine.

Error 2
Is there a way to stop vistor to submit number of comments from the same IP address?

It would be appreciated if you can clarify the doubt here so that all can benefit.

Regards
~ Ramakrihna

Posted by ramakrishna (www.coolgraphs.com)on Tuesday, 02.2.10 @ 11:54am | #10743

ththt

Posted by tester on Tuesday, 02.2.10 @ 11:15pm | #10747

asdf asdf asdf asdfsadf

Posted by G (www.sadf.com)on Wednesday, 02.3.10 @ 01:38pm | #10769

asdf asdf asdf asdfsadf

Posted by G (www.sadf.com)on Wednesday, 02.3.10 @ 01:38pm | #10770

testing

Posted by steve on Thursday, 02.4.10 @ 07:17am | #10782

asdfsadfasdf

Posted by sdfsdf (yuyuyu)on Thursday, 02.4.10 @ 08:01am | #10783

testsstst

Posted by testtttt on Friday, 02.5.10 @ 02:03am | #10799

delete

Posted by step on Friday, 02.5.10 @ 05:01am | #10800

Hi Brian, thank for the script, i also have a problem when you submit, it doesnt refresh, After submission of comments the resulting page shows Submission successful and keep on reloads the same page forever and it is not redirecting to the previous page where comments have been submitted. Also for each auto refresh (error) it adding a blank row in the database and increasing number of rows

Posted by Tony on Saturday, 02.6.10 @ 03:32am | #10810

Hi Brian, thank for the script, i also have a problem when you submit, it doesnt refresh, After submission of comments the resulting page shows Submission successful and keep on reloads the same page forever and it is not redirecting to the previous page where comments have been submitted. Also for each auto refresh (error) it adding a blank row in the database and increasing number of rows

Posted by Tony on Saturday, 02.6.10 @ 03:33am | #10811

Hi Brian, thank for the script, i also have a problem when you submit, it doesnt refresh, After submission of comments the resulting page shows Submission successful and keep on reloads the same page forever and it is not redirecting to the previous page where comments have been submitted. Also for each auto refresh (error) it adding a blank row in the database and increasing number of rows

Posted by Tony on Saturday, 02.6.10 @ 03:33am | #10812

thanx nice script.
it helped me a lot

Posted by papu (howazzat.com)on Saturday, 02.6.10 @ 10:28am | #10817

thanx nice script.
it helped me a lot

Posted by papu (howazzat.com)on Saturday, 02.6.10 @ 10:29am | #10818

Leave your comment:

Learn how to add this comment form to your site with our comment form tutorial!

Name:

Email:

URL:

Comments:


 
Guess the letters and numbers
(passphrase riddle)
--
0 chars before U
,
'b'
and not a
"R",
but
1 chars before F
followed by
'T' +3 letters
,
1 chars before O
-
'Q' +3 letters
,
→ retype that here
Enter the correct letters and numbers from the image into the text box. This small test serves as access restriction against malicious bots. Simply reload the page if this graphic is too hard to read.
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.