Question: You are processing a web form for a product review. It collects the following: email address (text field called email ), rating (radio buttons labelled

You are processing a web form for a product review. It collects the following: email address (text field called email), rating (radio buttons labelled from 1-5, called rating), comment (textarea called comment).

Given the code below, do the following: get the data from the form, validate email (if invalid: redirecting the user to error.php with an error parameter(key: email) in the url and quit), sanatize and html-ify the comment field, insert the data collected into the database using PDO, and redirect the user to thankyou.php. [10 marks]

include includes/library.php;

$pdo = connectDB();

$query = insert into comments (email, rating, comment) values (?, ?, ?);

//your code would go here

?>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!