dqdz6464 2015-10-22 17:31
浏览 29

跨会话保存数据-PHP

If one wanted to have a review section on there website how do you go about saving the information so that anybody who comes across the site can see the review of the product?

Example:

<form method="post" action="postToThisPage.php">
     <input type="text" name="review" id="productreview">
     <input type="submit" id="submitbtn value="Submit Review">
</form>

<h1>Product Review</h1>
<p id="review_2></p>

var button = document.getElementById("submitbtn"),
    review = document.getElementById("productreview").innerHTML;

    button.addEventListener("click",function(){
    var review = document.getElementById("productreview").innerHTML;

   document.getElementByID("review_2").innerHTML = review;
})

I would like to be able to save the information that will be put into the so that if anybody came across the site they could see it. How do I save the information that is posted?

I think the answer lies in PHP but I am still not sure how to go about it.

  • 写回答

1条回答 默认 最新

  • drkrsx3135168 2015-10-23 09:31
    关注

    Database or save the info to files.

    As for how to do that...teaching you how to build a comments/review system from "Hello World" to completion is a bit beyond the scope of any answer I'm going to be typing up on here. But a tutorial is here.

    A simple google search for "how to build a PHP review system" reveals many more.

    评论

报告相同问题?