This is only a rough idea (styling your choice, form creation your choice (i assumed post and 2 text fields named comments and name), not tested). You could make the text files XML if you wanted....
#count_comments.txt contains
0
#comments.txt doesn't need content to start
#submit comment page code
PHP Code:
<?php
if (isset($_POST['comment']) && $_POST['comment'] != "") {
$commet = $_POST['comment'];
$name = $_POST['name'];
$count = file_get_contents('count_comments.txt');
settype($count, "integer");
$count++;
$comment_is = "\nComment # $count<br /><strong>Name:</strong>$name<br /><strong>Comment:</strong><br />$comment\n";
$file = 'comments.txt';
file_put_contents($file, $comment_is, FILE_APPEND);
}
?>
#display comments page code
PHP Code:
<?php
$file = 'comments.txt';
$count = file_get_contents($file);
echo $count;
?>
Bookmarks