Homework Help Question & Answers
12. Suppose you are going to make an online questionnaire to collect information of current trend…
12. Suppose you are going to make an online questionnaire to collect information of current trend of the social networking App. The questionnaire has already been drafted for you as shown below. When the questionnaire is submitted to the Web server, the server-side logic will check whether all necessary information has been entered. If not, an error message “The survey is not completed!” will appear on a web page and it will automatically divert the browser to the questionnaire page after 5 seconds. Otherwise, the input data will be inserted to the database. Which of the following social networking App(s) are you a member of? Facebook Instagram Snapchat WeChat What is your age? 18-24 25-34 35-44 45-54 55 or above Name: Submit a) Write an HTML form in form.html that fulfills the requirements of the questionnaire. The form data is to be submitted to process.php using POST method. Assume every question has no default value. [10 marks] b) Write down the php logic of checking missing data from the HTML form, which displays the error message and diverts to the questionnaire page as mentioned above. [6 marks] c) Suppose the database has the following information: Server name Database Login ID Password compserver exam root comp3421 and a table called “questionnaire” with the fields, “name”, “age”, and “apps”. All fields have a data type of varchar(80). Write down all php logic of inserting the submitted data to the database. After successful insertion of data, it should display “Thank you for completing the questionnaire!” Note: Consider carefully the format of the data to be inserted. [8 marks]
Add a comment