我在互联网上看到的留言簿类型情况的评论发布教程对许多其他人来说都很好,但对我来说,我一直有
" . $name. ":
" . $content . "
"); fclose ($handle); } ?>
出现在评论框上方。在php中完成所有操作后,它也不会发布任何内容。这是代码:
<?php
if($_POST){
$name = $_POST ['name'];
$content = $_POST ['commentcontent'];
$handle = fopen("JackPackNetwork.html","a");
fwrite ($handle, "<b>" . $name. "</b>:<br/>" . $content . "<br/>");
fclose ($handle);
}
?>
<html>
<head>
</head>
<body>
<form action="" method= "POST">
Comments: <textarea rows= "10" cols= "30" name= "commentContent"></textarea> <br/>
Name: <input type= "text" name = "name"> <br/>
<input type= "submit" value = "Post!"> <br/>
</form>
<?php include "JackPackNetwork.html"; ?>
</body>
</html>
具体来说,我想链接到JackPackNetwork.html并更新评论,并且能够让某人能够在其上添加他们的名字。感谢您的时间和考虑。
答案 0 :(得分:0)
您的代码应如下所示:
<?php
if($_POST){
$name = $_POST ['name'];
$content = $_POST ['commentContent'];
$handle = fopen("JackPackNetwork.html","a");
fwrite ($handle, "<b>" . $name. "</b>:<br/>" . $content . "<br/>");
fclose ($handle);
}
?>
<html>
<head>
</head>
<body>
<form action="" method= "POST">
Comments: <textarea rows= "10" cols= "30" name= "commentContent"></textarea> <br/>
Name: <input type= "text" name = "name"> <br/>
<input type= "submit" value = "Post!"> <br/>
</form>
<?php require_once("JackPackNetwork.html"); ?>
</body>
</html>
<强> MISTAKE 强>
<强>建议强>