Php code for Comment on Webpage

webmaster
By -
0

Php code for Comment on Webpage

$Yourwebpage.php

<!-- 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">

            <tr>

              <th colspan="2"><? if($_POST["do_comment"]==1) {

                                        $name=$_POST["name"];

                                        $email=$_POST["email"];

                                        $website=$_POST["website"];

                                        $comment=$_POST["comment"];

                                        $page=$_POST["page"];

                                        $status=0;

                                        $page=$_post["page"];

                                        $query="insert into comment values('$name','$email','$website','$comment',$status,'$pfile')";

                                        $result=mysql_query($query);

                                        if($result!=NULL)

                                            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>

            </tr>

            <tr>

              <td>Enter Your Name</td>

              <td><input type="text" size="20" name="name" /></td>

            </tr>

            <tr>

              <td>Enter Your Email</td>

              <td><input type="text" size="20" name="email" /></td>

            </tr>

            <tr>

              <td>Enter Your Blog</td>

              <td><input type="text" size="20" name="website"  value="http://"/></td>

            <tr>

              <td colspan="2">Enter Your Comment</td>

            </tr>

            <tr>

              <td colspan="2" align="center"><textarea rows="5" cols="25" wrap="virtual" name="comment"></textarea></td>

            </tr>

            </tr>

            <tr>

              <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>

            </tr>

          </table>

        </form>

                       

                        </td>

      <td valign="top"><!-- Comments Display Section  !-->

          <div id="comment">

            <center>

              <b>Comment on <? echo $pfile; ?></b>

            </center>

            <br />

            <?

                        $query="select * from comment where page='$pfile' and status='1'";

                        $result=mysql_query($query);

                        $temp=0;

                        while ($row = mysql_fetch_array($result)) {

                            $temp=1;

                            if($row[2]==NULL || $row[2]=="http://")

                                echo "<b>",$row[0]," (",$row[1],") </b><i>Wrotes</i> <b>",$row[3]," </b><hr>";

                            else

                                echo "<a target='_blank' href='",$row[2],"'><b>",$row[0],"</a> (",$row[1],")</b><i> Wrotes </i><b>",$row[3],"</b><hr>";

                        }

                        if($temp==0)

                            echo "<i>No comment on this section</i>";

 

                        ?>

          </div>

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

</div>

</center>

 

                          </td>

      </tr></table>

 

 

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

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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.


 

 


Books are a treasure trove of knowledge. It is essential to inculcate reading habits from an early age to develop vocabulary and imaginative skills. Whether you are looking for storybooks for kids, novels for grown-ups, study material for education, preparatory books for competitive exams, or copies related to art and craft, you can browse and explore a wide range of options available at online bookstores. Discover the magic of literature available in a plethora of international languages like English, Spanish, French, German, Japanese, Korean, Russian, Arabic, Latin, Yiddish or regional languages like Hindi, Kannada, Malayalam, Marathi, Gujarati, Tamil, and more. Explore the collection and shop for books online. You can find your favourite literature, novels, storybooks, and more on offer and at great discounts. You can buy them to build your own collection or gift them to a reading enthusiast. You can buy them in paperback, hardcover, boxed set, leatherbound, as well as audio formats during this sale. Some of the must-have titles in every reading enthusiast library are The Alchemist by Paulo Coelho, The Secret by Rhonda Byrne, Ikigai by Garcia Hector. Kids will love stories by Ruskin Bond, Sudha Murty, Enid Blyton, and J. K. Rowling.


Join our Telegram Channel https://t.me/eduvibeschannel

if you want to share your story or article for our Blog please email us at educratsweb[@]gmail.com >>


Tags:

Post a Comment

0Comments

Post a Comment (0)