Creating a Review Form in PHP and sending the data to a mysql database

Posted on 2004-12-01
Last Modified: 2011-09-20
Basically what I am doing is creating a page that allows users to review their favorite book.  I have a MYSQL database with 3 tables, book, review and user, I already have my User logging in, so this is basically what I need to do.  When the user is in a book page it sends the Review that the user had created about 250 characters.  And they also give it a number ranking between 1 and 10, so, so far I have two text boxes one named review and one named rating.  Now all I have to do is send all that data to the the review table with the fields userid, bookid, rating, review Thanks in advance for any help
Question by:balonyJoes90210
    LVL 9

    Accepted Solution

    assuming the form called the values userid, bookid, rating and review, the submitReview.php page would look like this:

    $userid = $_POST['userid'];
    $review = $_POST['review'];

    mysql_query("INSERT INTO review VALUES(userid, bookid, rating, review) ($userid, $bookid, $rating, '$review')");

    echo "Successfully added your review...";


    note that the order of elements in the insert statement may have to follow their order in the table.

    Author Comment

    Thanks that was a big help, Thanks again.
    LVL 1

    Expert Comment

    Please close the question if you have received a satisfactory response.  Thanks. :)


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now