I have a website and I want to make it possible to send comments anywhere on the site through one php page. The problem I wrote the following code on PHP and it keeps all responses only into one html page. How can I keep all responses into one html page show per page just the reactions belonging to the same page?
here my php code:
$handle = fopen("comments.html","a");
fwrite ($handle,"<b>" . "<h2 style=" . "\"color:blue;\"" . ">" . $_POST["name"] . "</b></h2>" . $_POST["comment"] . "</br><hr>" );
fclose ($handle);
and here my html code, I want him to see only the comments written on this page.
<h2 style="color:green;">comments:</h2>
<p><span class="error" style="color:red;">* must</span></p>
<form method="post" action="comments/comments.php">
<span class="error" style="color:red;">* <?php echo $nameErr;?></span>
name:
<input type="text" name="name">
<br><br>
comment:
<textarea name="comment" rows="5" cols="40"></textarea>
<br>
<input type="submit" name="submit" value="send:">
<input type="reset" value="clear:"
<hr>
</form>
<?php
include "comments/comments.html";
?>
tnx!
</div>