?
Solved

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

Posted on 2004-12-01
3
Medium Priority
?
252 Views
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
0
Comment
Question by:balonyJoes90210
3 Comments
 
LVL 9

Accepted Solution

by:
keteracel earned 920 total points
ID: 12720614
assuming the form called the values userid, bookid, rating and review, the submitReview.php page would look like this:

<?php
$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.
0
 

Author Comment

by:balonyJoes90210
ID: 12720962
Thanks that was a big help, Thanks again.
0
 
LVL 1

Expert Comment

by:sfinktah
ID: 12722045
Please close the question if you have received a satisfactory response.  Thanks. :)

Cyrus
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

589 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