Saturday, 30 July 2011

Php code for Comment on Webpage

Php code for Comment on Webpage
<!-- Comment Entry Section  !-->
    <table cellpadding="0" cellspacing="0"><tr>
      <td width="25%" valign="top"><form method="post" action="<? echo $pfile;?>" name="comment">
          <table bgcolor="silver" align="center" cellpadding="5" cellspacing="0" width="270px">
              <th colspan="2"><? if($_POST["do_comment"]==1) {
                                        $query="insert into comment values('$name','$email','$website','$comment',$status,'$pfile')";
                                            echo "<font color='red'>Thanks for your comment ; Your comment need approval after approval it will be display on website.</font><br>";
                <? $file = $_SERVER["SCRIPT_NAME"];
                                    $break = Explode('/', $file);
                                    $pfile = $break[count($break) - 1];
                Write your comment</th>
              <td>Enter Your Name</td>
              <td><input type="text" size="20" name="name" /></td>
              <td>Enter Your Email</td>
              <td><input type="text" size="20" name="email" /></td>
              <td>Enter Your Blog</td>
              <td><input type="text" size="20" name="website"  value="http://"/></td>
              <td colspan="2">Enter Your Comment</td>
              <td colspan="2" align="center"><textarea rows="5" cols="25" wrap="virtual" name="comment"></textarea></td>
              <td colspan="2" align="center"><input type="hidden" name="do_comment" value="1" />
                <input type="hidden" name="page" value="<? echo $pfile; ?>" />
                <input type="submit" value="Submit" />
                <input type="reset" value="Clear" /></td>
      <td valign="top"><!-- Comments Display Section  !-->
          <div id="comment">
              <b>Comment on <? echo $pfile; ?></b>
            <br />
                        $query="select * from comment where page='$pfile' and status='1'";
                        while ($row = mysql_fetch_array($result)) {
                            if($row[2]==NULL || $row[2]=="http://")
                                echo "<b>",$row[0]," (",$row[1],") </b><i>Wrotes</i> <b>",$row[3]," </b><hr>";
                                echo "<a target='_blank' href='",$row[2],"'><b>",$row[0],"</a> (",$row[1],")</b><i> Wrotes </i><b>",$row[3],"</b><hr>";
                            echo "<i>No comment on this section</i>";

   <div align="right" style="padding:5px;" ><a href="comment.php" style="color:#0000FF">View All</a></div>

Table of Enquiry
CREATE TABLE `comment` (
  `name` varchar(20) NOT NULL default '',
  `email` varchar(40) default NULL,
  `blog` varchar(40) default NULL,
  `comment` text,
  `status` tinyint(1) default '0',
  `page` varchar(20) default NULL
Comment will be Display on web page when status will be 1. So create admin section to change or alter the Data of comment posted by the user or you can store 1 when you don't need of authorization required.
"Php code for Comment on Webpage" Php code is made for Distribution purpose;
Modify it as per your requirement.



If you have any article, photograph, video etc which you want to share with us through our blog. You can send email us at or click here


  1. bookmarked!!, I really like your website! Payday Loans
    Feel free to visit my blog - payday loans

  2. Good post. I learn something totally new and challenging on sites I stumbleupon everyday.
    It's always helpful to read through articles from other writers and practice something from their websites. raspberry ketone cla
    Here is my webpage raspberry ketones

  3. I could not resist commenting. Very well written!
    Feel free to surf my weblog ... instant cash

  4. Spot on with this write-up, I really think this website needs a lot more attention.

    I’ll probably be back again to read more, thanks for the info!
    payday loans
    Stop by my blog :: link

  5. Right here is the right site for everyone who would like to understand this topic.
    You understand a whole lot its almost hard to argue with you (not that I really will need
    to…HaHa). You certainly put a fresh spin on a subject which has been written about for decades.
    Excellent stuff, just wonderful! link
    Also visit my web-site :: here

  6. Your style is really unique compared to other people I have read stuff from.

    Many thanks for posting when you've got the opportunity, Guess I'll just bookmark this blog. free bets
    Also visit my website ...

  7. I blog often and I truly thank you for your information.
    Your article has truly peaked my interest. I will take a note of your website and
    keep checking for new details about once per week. I subscribed to your Feed as well.

    payday loans
    Have a look at my web-site :: next page

  8. You are so interesting! I do not suppose I've read something like this before. So wonderful to find another person with some original thoughts on this issue. Really.. thanks for starting this up. This site is something that is needed on the internet, someone with some originality! more info
    Here is my web blog ... raspberry ketone

  9. I need to to thank you for this fantastic read!
    ! I certainly enjoyed every little bit of it. I have got you book-marked to look
    at new things you post… pay day loans uk
    Here is my web-site :: payday loan uk