I want to create a PHP homepage can be written in comments are saved into a blank HTML page. I want to allow the webmaster to write in place of 'Name' code to paint the message in red and display the name called a master. I tried the code attached but it did not work for me and it wrote the code in place of 'Name' and wrote 'Maneger' and the message in default color. It's probably because I do not know good conditions with variables in PHP (This is the first time I use this language ...) Can anyone fix my code? tnx!
here my code:
<?php
if ($_POST){
$name = $_POST['name'];
$content = $_POST['commentContent'];
$handle = fopen("comments.html","a");
if ($_POST['name']=="d1234"){
$_POST['name']="maneger";
fwrite ($handle,"<hr><b>" . "<h2 style=" . "color:red;" . ">" . $name . " </h2></b></br>" . "color:red;" . $content . "</br><hr>");
fclose ($handle);
}
else{
fwrite ($handle,"<hr><b>" . "<h2 style=" . "color:blue;" . ">" . $name . "</h2></b></br>" . $content . "</br><hr>");
fclose ($handle);
}
}
?>
<html>
<body>
<form action="" method="POST">
Comment: <textarea rows ="3" cols ="30" name="commentContent"></textarea> </br>
name: <input type = "text" name = "name"></br>
<input type = "submit" value = "!פרסם"></br>
</form>
<?php include "comments.html"; ?>
</body>
</html>