我做了一个评论表,但我想添加一个简单的"回复"选项。我花了好几个小时试图这样做,但我没有运气。我不需要登录页面,只需要回复选项。请帮忙!
这是php文档中的表单代码:
<html>
<form action="" method="post">
<label>Name: <br><input type="text" name="name"><br></label>
<label>Message: <br><textarea cols="35" rows="5" name="mes">
</textarea></label><br>
<input type="submit" name="post" value="Post">
</form>
</html>
<?php
$name = $_POST["name"];
$text = $_POST["mes"];
$post = $_POST["post"];
if($post){
#WRITE DOWN COMMENTS#
$write = fopen("com.txt", "a+");
fwrite($write, "<u><b> $name</b></u><br>$text<br>");
fclose($write);
#DISPLAY COMMENTS#
$read = fopen("com.txt", "r+t");
echo "All comments:<br>";
while(!feof($read)){
echo fread ($read, 1024);
}
fclose($read);
}
else{
#DISPLAY COMMENTS#
$read=fopen("com.txt", "r+t");
echo "All comments:<br>";
while(!feof($read)){
echo fread ($read, 1024);
}
fclose($read);
}
?>
非常感谢帮助!