guys i am new to php and all what i know is html .so please tell me how to create a commenting box that allow people to comment on my website or my post .

7 Years
Discussion Span
Last Post by sandeepji1


First you will have to create gui(text fields and buttons) to get that details

Person Name-
Email ID-:

On this form you will have buttons Save and Cancel.

On click of Save button your form(form where that save button is) should be redirected to a little php script to save that comment entry.After inserting that entry into a database that should redirected user to a HOME page or where ever you want him to go on.

These values you will have to store in a database or in a file.

You have two ways
As omol suggested
one is using mysql database.
Create table in a database
Table name-comments

Add Fields with proper datatype
name, email, comment, datetime

and second ways is write that entries in a text file or csv separated by delimiter.

If you have any doubt Please let me know.



Hi, You Just Try That Code that Help You

// Now, We Perform Saving Operation.
if(isset($_POST['dir_save']) == 'Save')
$query=mysql_query("INSERT INTO dir_registration(comment)             VALUES('$user_comment')",$connect);
//Now We Perform Cancel operation.
 if(isset($_POST['dir_cancel']) == 'Cancel')
// Now We Perform Reset operation.
   if(isset($_POST['dir_reset']) == 'Reset')
         $user_comment = ' ';

<form name="registration_dir" method="post" action="registration_dir.php">
<div align="center">
<input type="hidden" name="posted" value="true");
<input type="submit" name="dir_save" value="Save">&nbsp;
<input type="submit" name="dir_cancel" value="Cancel">&nbsp;
<input type="reset" name="dir_reset" value="Reset">
<table align="center" border="">
             <td><b>Address</b><br />
               <textarea  name="dir_usercomment" rows="3" cols="33">
                 !! Enter Comment Here !!

and still you have problem Then Just Mention Here.

Edited by Reverend Jim: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.