Submission: PHP and HTML files
This lab assignment's purpose is to give you some practice writing a PHP script that processes an HTML form. You will also practice server-side form validation, class and object, and file handling using PHP.
You will write code to complete a web service that allows students to submit their suggestions/feedback. The HTML page [login to view URL] will contain a form that submits to comments.php. After submission, [login to view URL] will do some checks to validate the information submitted, and it will output a web page that either confirms the submission or informs the user to try submitting again.
Task 1: Creating a Form
This task involves creating an HTML form (such as [login to view URL] ) that POSTs its submitted data to a PHP program on a server. The form should at least has a set of radio/checkbox button, 2 text input fields, 1 comment input field, and 1 - 2 buttons. No student will have the similar feedback.html.
Task 2: Displaying Input Data
In this task, you will write the PHP page that will handle the submitted form data. Tell your [login to view URL] to POST data to a comments PHP page (such as [login to view URL]). The [login to view URL] page will receive the parameters from [login to view URL] and will output an HTML confirmation page.
Task 3: Save the Form Data
Modify your [login to view URL] page to save the submitted data to the file comments.txt. Also change your page's output to show the complete contents of the file [login to view URL] to the user.
Task 4: Basic Data ValidationUpdate your [login to view URL] file to verify that the user did not leave any fields blank when submitting the form. You can check whether a particularparameter has been passed using the PHP function isset. If the user has not filled in every field, show an error message instead of displaying their submitted data.
Notes: Make sure you define and use objects in your PHP codes.