First you will have to look at HTML forms. Here is an example:
<form name="comment_form" method="post" action="example.php">
<label for="poster_name">Name:</label>
<input type="text" name="poster_name" size="20" maxlength="32" /><br />
<label for="poster_email">Email:</label>
<input type="text" name="poster_email" size="20" maxlength="32" /><br />
<label for="poster_comment">Comment:</label>
<textarea name="poster_comment" rows="10" style="width:300px"></textarea><br />
<input type="submit" value="Post comment!" name="submit_btn" id="submit_btn" />
</form>
To process the values entered by the user, you must have a script doing that. In this case the script is example.php.
There are two ways of transmitting information submitted: GET and POST.
Transmitting with GET will result, that values entered in fields will show up in your browsers address bar. POST is "silent".
In PHP there are a few ways to get submitted values: there are some predefined variables, which get these values.
For example if we use the POST method, then the values will show up in the $POST predefined variable(array).
These said, the name of poster will be found in $POST['poster_name'], and so on...
So here is example.php written for you:
<?php
if (isset($_POST['submit_btn'])) { // submit button was pressed, so a comment was submitted
// Do anything you want with comment
// for example print out
print('Comment posted by: '.$_POST['poster_name']);
print('With e-mail address: '.$_POST['poster_email']);
print('His/her comment: '.$_POST['poster_comment']);
}
print('
<html>
<body>
<form name="comment_form" method="post" action="example.php">
<label for="poster_name">Name:</label>
<input type="text" name="poster_name" size="20" maxlength="32" /><br />
<label for="poster_email">Email:</label>
<input type="text" name="poster_email" size="20" maxlength="32" /><br />
<label for="poster_comment">Comment:</label>
<textarea name="poster_comment" rows="10" style="width:300px"></textarea><br />
<input type="submit" value="Post comment!" name="submit_btn" id="submit_btn" />
</form>
</body>
</html>
');
?>
The isset function is returning true, if the variable passed as argument exists(is set). So if the submit button was pressed, the $_POST['submit_btn'] variable will be set, and more, will have the value "Post comment!".
If isset returns true, you may want to store the comment in your database and display it, or whatever you want.
Hope it helps, good luck.