POTD 4: Form handling and state maintenance (Cookies)
Due 3-June-2022, 1pm EST (no late submission, no extension)
Purpose:
Hands-on experience with PHP and state maintenance in web apps; get ready to work on your assignment (course project)
For this activity, you may work alone or with another student in this course.
You will implement a simple survey using PHP and client-side
cookies.
You may use the provided
templates as a starting point and create more files as needed
(save them in .html or .php depending on your implementation)
or implement a survey from scratch.
Perform the following tasks:
- Create a login component
- Allowing a user to login to complete a survey.
- For simplicity, no sophisticated authentication is need.
That is, you may simply use conditionals and hard-coded authentication.
- Once a user has logged in (or registered), redirect the user to a survey instruction
- Create a survey instruction component
- Display the current user name on the screen
- Provide textual instruction
(optional, a short video/animated instruction also provides reasonably good usability)
- Provide an option to start the survey
- Provide an option to logout from the system
- Create survey questions.
You will have at least 4 survey questions.
Note: some sample questions (template above) are provided for you.
You may use them or create new ones of your choice.
- Display the current user name on the screen
- Display the question and answer.
If the survey has a short-answer / long-answer type of questions, be sure to prepare
a textual space for an answer (consider the kinds of HTML form elements to be used).
- Display all previous answers on the screen. That is,
- no previous answer on the screen when the first question is displayed
- on the screen that displays the second question, an answer to the first question is displayed
- on the screen that displays the third question, answers to the first and second questions are displayed
- Provide a submit button that processes the form data entry and proceeds to the next question
- You decide how the last question screen should be -- consider the usability of the system
- Create a logout component
- Terminates the survey and redirects to a login screen
- Enforce login
- On every page, if the user has not logged in, redirect the user to the login page.
To deploy and test your program
use one of the following options:
Grading rubric
[Total: 10 points]: Done (or provide evidence of your attempt, full or reasonable effort)
- (5 points) — Providing evidence of your attempt, minimal effort
- (0 point) — No evidence of your attempt
Submission
- Log in to Collab, then upload all your files (.php, and other files needed to complete this POTD)
to POTD 4 on Gradescope.
- Make sure you connect your partner(s) to your group on Gradescope so that everyone receives credit
- Each team submits only one copy
Making your submission available to instructor and course staff is your
responsibility;
if we cannot access or open your file, you will not get credit.
Be sure to test access to your file before the due date.
Copyright © 2022 Upsorn Praphamontripong
Released under the
CC-BY-NC-SA 4.0 license.
Last updated 2022-06-01 23:12