Loading...

How to make a comment form in HTML & PHP

How to make a comment form in HTML & PHP
New version of this video: https://www.youtube.com/watch?v=0KwnPS5OhGI&feature=youtu.be
Как се правят коментари в сайта на HTML и PHP
Как сделать комментары в сайте на HTML и PHP

RRelated Posts

How to create a simple comment system in PHP

This short tutorial will teach you how to create a simple comment system in PHP using PHP's fwrite function to write comments to a text file and then include that file on our web page. Sorry the

Live PHP Comment System using Ajax Jquery

How to make comment system using PHP with Ajax, Jquery, Bootstrap and Mysql. How to create Nested Comment System in PHP with Ajax. How to developed Live comment system using Ajax JQuery with PHP

CComments

  • MD Rakibul Islam
    tnx
  • todoroki doki
    it's working but theres an error msg in the webpage everytime i delete all the content in com.txt
  • Joseph Manatad
    in your tutorial is it possible to put delete feature on the project?
  • Sunil Gaha
    kiki do you love me? Are you riding? :D
  • TheAlexGamer 03
    what is the "a+" and the "t+r" next to the com.txt????
  • adam harith
    did we need to write php in html?
  • adam harith
    what is the function of php
  • Nijat Ali
    waiting for your next video
  • Nijat Ali
    nice
  • TECHNOLOGY GEAR
    Can you please send me the source code
  • Madara Paths
    How do i show the date and time and how do i show newest comments at the top and old comments down ?
  • Gacha Wolfie
    Works pretty good and can be tweaked to fit your website. How do you get the com.txt load each time you visit the page?, it seems it only shows up after you make a comment.
  • Dhruv Singh 828
    Thanks..
  • Navvye Anand
    privet
    Can we not put text area instead of <input>
    Spasibo
  • Idiotic jelly
    or do I need to buy a Domain?
  • Idiotic jelly
    does this work in notepad? I don't have np++
  • Sujan Acharya
    hey can you help me make school project ...
    its too hard for me cause i was absent when the chapter html was taught.And the big problem is recently our computer teacher has been changed.I just don't know how to make one i would become fail if i don't make one.Please !please!! help me :( :(
    i have to submit it within 3 days.
    please help me
  • Shan Dani
    Hey man, if you want to do a video, please talk.
  • 12397bmw
    How to I make a comment box only allow people to comment if they are logged into my website
  • Jehel
    how to add it into html file?
  • Brahimi Hadjer
    please how can i creat a systeme comment without php just with html and CSs
  • CodeTech Anish
    please give me a link of your code s
  • Fang Saechao
    $ name
    $ text
    "); fclose($ write); #DISPLAY COMMENTS# $ read = fopen("com.txt", "r+t"); echo "All comments:
    "; while(!feof($ read)){ echo fread($ read, 1024); } fclose($ read); } else{ #DISPLAY COMMENTS# $ read = fopen("com.txt", "r+t"); echo "All comments:
    "; while(!feof($ read)){ echo fread($ read, 1024); } fclose($ read); } ?>

    What should i fix?
  • Maimoona Abrar
    can you please tell me how do i made comment post to another page...like if i enter comment and it goes to another html file...not the file in which is commentbox
  • VAHBS TV
    This brings me to something


    $name
    $text
    "); fclose($write); $read = fopen("com.text", "r+t"); echo "All Comments:
    "; while(!feof($read)){ echo fread($read, 1024); } fclose($read); } else{ $read = fopen("com.text", "r+t"); echo "All Comments:
    "; while(!feof($read)){ echo fread($read, 1024); } fclose($read); } ?>?


    What should I do?
  • KriskoNinja BG
    BG?
  • Akin Cetin
    I did everything on video. But I don't know how I can add to server. Can you help me? I installed "wampserver"
  • Kath Leen
    Notice: Undefined index: name in C:\xampp\xampp\htdocs\MyFirstWebsite\postcomment\com.php on line 18

    Notice: Undefined index: mes in C:\xampp\xampp\htdocs\MyFirstWebsite\postcomment\com.php on line 19

    Notice: Undefined index: post in C:\xampp\xampp\htdocs\MyFirstWebsite\postcomment\com.php on line 20

    what should I do? ;(
  • Hetty Hurkmans
    Thanks for this great video!
    But I have one question. Is it also possible to place the comments in a label?
  • Peter Rybín
    Fabulous! But, please: how to display posts into ascending order, where the latest post is at the top (and the oldest at the bottom end)?
  • Soflo Antonio
    why the hell you named this vid in english and then you make everything in russian?!
  • Alvin adam.bonner
    Hi,how do you make it display new comments above old comments? i tried ($read,1024) but its not working. please help
  • Lena Kiki
    You need to INSTALL A LOCAL WEB SERVER to run PHP scripts! Otherwise PHP will display as plain text. The local web server makes an environment like on a web host, so you can run scripts like PHP that use servers to process the data. But languages like HTML, CSS and JavaScript don't need one.

    PHP won't work without a web server!

    Good local web servers are:
    XAMPP - https://www.apachefriends.org/index.html
    Денвер - http://www.denwer.ru/
    WAMP - http://www.wampserver.com/en/
  • Xhizors24
    Rep for this +1
  • Nigurt
    what did I do wrong?


    <html>

    <form action="method"="post">

    <label> Name: <br>input type ="text" name="name"><br></label>

    <label Message: <br>textarea cols= "45" rows="5" name="mes"

    </form>

    </html>




    <?php

    $name = $_POST ["name"];
    $text = $_POST["mes"];
    $post = $_POST["post"];

    if($post)" {

    #WRITE DOWN COMMENTS#

    $write = fopen("com.text"), "a+");
    fwrite($write), "<u><b> $name<b></u><br>$text<br>");
    fclose($write);

    #DISPLAY COMMENTS#

    $read = fopen("com.text"), "r+t");
    echo "All comments:<br>";

    while(!foef($read)) {
    echo fread($read,1024);
    }

    fclose($read);

    }



    }

    ?>
  • Game Live Studios
    okay I know this video is really old and I am probably going to sound stupid for this I figured out how to change the name and message color and move them around where I want to place them but when it comes to posted comments I can't seem to figure out where to move/change there color at all anyone know how?
  • Slim ardnas
    There are videos on YouTube posted by the Guardians of the North, which are a breach of YouTube privacy regulations. These men have been identifies by images/ videos and names., without the person involved's permission. The Guardians then assault verbally and or physically , using specific sexual terminology, without obvious proof. Why are YouTube allowing this to happen?
  • SkraptZz
    My website shows this
    $name
    $text
    "); fclose($write); #DISPLAY COMMENTS# $read = fopen("com.txt", "r+t"); echo "All comments:
    "; while(!feof($read)){ echo fread($read, 1024); } fclose($read); } else{ #DISPLAY COMMENTS# $read = fopen("com.txt", "r+t"); echo "All comments:
    "; while(!feof($read)){ echo fread($read, 1024); } fclose($read); } ?>
    Where all the comments should be :(
    Please help
  • Permission one rule supersedes
    Everything is working fine. However this appears.

    Notice: Undefined index: name in C:\xampp\htdocs\i_hate_permission\index.php on line 33

    Notice: Undefined index: mes in C:\xampp\htdocs\i_hate_permission\index.php on line 34

    Notice: Undefined index: post in C:\xampp\htdocs\i_hate_permission\index.php on line 35
  • Owen Noel
    I did everything the way as it showed in the video but this is what I get:
    http://nfcent.com/com.txt.htm. Tell me what I'm doing wrongHere is the code:<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Name</title>
    </head><body>
    <form action="" method="post"><label>Name:<br>
    <input type="text" name="name"><br></label><label>Message:<br>
    <textarea cols="25" rows="5" name="mes"></textarea></label><br><input type="submit" name="post" value="Post">
    </form><?php$name = $_POST["name"];
    $text = $_POST["mes"];
    $post = $_POST["post"];if($post){#WRITE DOWN COMMENTS#$Write = fopen("com.txt", "a+");
    fclose($write, "<u><b> $name</b></u><br>$text<br>");#DISPLAY COMMENTS#$read = fopen("com.txt", "r+t");
    echo "All comments:<br>";while(!feof($read){
    echo fread($read, 1024);
    }fclose($read);else{#DISPLAY COMMENTS#$read = fopen("com.txt", "r+t");
    echo "All comments:<br>";while(!feof($read){
    echo fread($read, 1024);
    }fclose($read);
    }?></body></html>
  • brian casewell
    i loved your comment staff you did from beela dowd i live in los banos
  • Jason Davis
    I am in Notepad ++. Did the code "perfect" as shown in the video. It is not working. It shows the comment bar, but everything under the /?php tag shows in as pure code. What language do I use? I am using html. I even saved it as index.php. What do I do?
  • ALF A\nas
    hi there i know this is to late to ask but forgive me for asking because i really need this answer , i have data a stord on my php my admen and i can restor thim on i white page with all the data on it, my question how can i put thous data in to html table form instead of of white page, note that i am still learning php. so forgive me ^_^
  • cesar padial
    Doesn't works. The form it looks perfect but below appears the following code:

    $name
    $text
    "); fclose ($write); #MOSTRAR COMENTARIOS# $read = fopen ("com.txt", "r+t"); echo "Todos los comentarios
    "; while(!feof($read)){ echo fread($read, 1024); } fclose($read); } else{ #MOSTRAR COMENTARIOS# $read = fopen ("com.txt", "r+t"); echo "Todos los comentarios
    "; while(!feof($read)){ echo fread($read, 1024); } fclose($read); } ?>

    And obviously if I try to comment doesn't works.

    This is my all code:

    <form action="" method="post">

    <label>Name: <br><input type="text" name="name"><br></label>

    <label>Message: <br><textarea cols="45" rows="5" name="mes"></textarea></label><br>

    <input type="submit" name="post" value="Enviar">

    </form>

    <?php

    $name= $_POST["name"];
    $text= $_POST["mes"];
    $post= $_POST["post"];

    if($post){

    #WRITE DOWN COMMENTS#

    $write = fopen("com.text","a+");
    fwrite($write, "<u><b> $name</b></u><br>$text<br>");
    fclose ($write);

    #DISPLAY COMMENTS#

    $read = fopen ("com.txt", "r+t");
    echo "Todos los comentarios</br>";

    while(!feof($read)){
    echo fread($read, 1024);
    }

    fclose($read);
    }

    else{

    #MOSTRAR COMENTARIOS#

    $read = fopen ("com.txt", "r+t");
    echo "Todos los comentarios</br>";

    while(!feof($read)){
    echo fread($read, 1024);
    }

    fclose($read);
    }

    ?>

    Can you help me please?
  • PkahD Luffy
    why my coding doesnt work? argh so stress !
  • nadroj kerem
    sir this does not work at all and i am really quite sad, all videos i watch all lead me to failure at this and i dont understand why. please help me understand why this does not work. :(
  • roby lopez
    sour cherry i already type your codes but the problem is theres a paragraph here just like this and i just need it i will use it in my thesis it will help big a lot thanks :) :) :) and also i type it in notepad cuz i don't have notepad ++
    <html>
    <form action ="" method="post">
    <label> Name: <br><input type="text" name="name"><br></label>
    <label> Message: <br><textarea cols="35" rows="5" name="mes"></textarea></label><br>
    <input type="submit" name="post" value="Post">
    </form>
    </html>

    <?php

    $name = $_POST["name"];
    $text = $_POST["mes"];
    $post = $_POST["post"];

    if($post) {

    #WRITE DOWN COMMENTS#

    $write = fopen("com.txt", "a+");
    fwrite($write, "<u><b> $name</b></u><br>$text<br>");
    fclose($write);

    #DISPLAY COMMENTS#

    $read = fopen("com.txt", "r+t");
    echo "All comments:<br>";

    while(!feof($read)) {
    echo fread($read, 1024);
    }

    fclose($read);

    }

    #DISPLAY COMMENTS#

    $read = fopen("com.txt", "r+t");
    echo "All comments:<br>";

    while(!feof($read)) {
    echo fread($read, 1024);
    }

    fclose($read);

    }
  • Dj Papai
    hi
  • Sete Woile
    can somebody please give me an answer what is wrong with this? I really needed it :D Soonier or later thanks you!!


    $name
    $mes

    "); fclose($write); #DISPLAT COMMENTS# $read = fopen("com.txt", "r+t"); echo "All comments:
    " while(!feof($read)){ echo fread($read, 1024); } fclose($read); } else{ #DISPLAT COMMENTS# $read = fopen("com.txt", "r+t"); echo "All comments:
    " while(!feof($read)){ echo fread($read, 1024); } fclose($read); } ?>