投稿ボタンを押すと、コメントがページに投稿されています。私がもう一度ヒットしたら、前のコメントよりも優先されます。誰かがこれを明らかにすることができますか?そして、私は日付を表示するJavaスクリプトを実行しています。コメントなしでも常時表示されています。どうすればそれも変更できますか? ありがとうございます!コメント欄のコメントは無効になっています投稿していません
<h3 id="reply-title" class="comment-reply-title">Leave a Reply </h3>
<form action="" method="post">
<p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> Required fields are marked <span class="required">*</span></p>
<p class="comment-form-comment"><label for="comment">Comment</label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" aria-required="true" required="required"></textarea></p>
<p class="comment-form-author"><label for="author">Name <span class="required">*</span></label> <input id="author" name="author" type="text" value="" size="30" maxlength="245" aria-required="true" required="required"></p>
<p class="comment-form-email"><label for="email">Email <span class="required">*</span></label> <input id="email" name="email" type="email" value="" size="30" maxlength="100" aria-describedby="email-notes" aria-required="true" required="required"></p>
<p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Post Comment"></p>
<div>
<?php
if($_POST) {
$name = $_POST['author'];
$comment = $_POST['comment'];
$email = $_POST['email'];
#echo $name . $comment . $email;
$handle = fopen("comments/get-more-twitter-followers.html", "a");
fwrite($handle, "\n".$name."\n".$comment."\n". $email. "\n");
fclose($handle);
}
?>
<?php
if($_POST) {
$email = $_POST['email'];
$useremail = fopen("useremail.html", "a");
fwrite($useremail, "\n".$email. "\n");
fclose($useremail);
}
?>
</div>
<div>
<div>
<p><strong><h4><u>Comments:</u></h4></strong></p>
</div>
<div>
<div>
<strong><?php
$name = $_POST['author'];
echo $name; ?> </strong> <small><script type="text/javascript">
var d = new Date()
document.write(d.getDate())
document.write("/")
document.write(d.getMonth() + 1)
document.write("/")
document.write(d.getFullYear())
</script>
</small>
</div>
<div>
<p>
<?php
$comment = $_POST['comment'];
echo "\n".$comment."\n"."<hr>";
?>
</p>
</div>
</div>
</div>
とAjaxのポストにURLを変更することを忘れないでください、私は、何かを理解していないあなたは、DBファイルにコメントを保存し、されていませんか? – Treast
あなたはファイルに書き込みますが、あなたはそれを読むことはありません。代わりに最新のコメントを書いています。 –
あなたのフォームはどこですか? –