Comment system help

Okay so i made this simple comment system that works great but i need it to delete the previous comment when a new one is posted. Not really sure how to accomplish this, but I’m trying to find a way to clear the whole html page that the comment writes to when a new one is posted…

Anyways heres the code:
[php]<?php
if($_POST){
$name = $_POST[‘name’];
$content = $_POST[‘commentContent’];
$publisher = $_POST[‘commentPublisher’];
$handle = fopen(“comments.html”,“a”);
fwrite($handle,"" . $name . “:
” . $content . “
-” . $publisher . “
”);
fclose($handle);
}

?>

Update:
Date:
Posted By:
[/php]

If you just want to clear the whole page and write a new one… would you just change this?

Change:

[php]$handle = fopen(“comments.html”,“a”);[/php]

To:

[php]$handle = fopen(“comments.html”,“w”);[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service