Activity: PHP state maintenance (Session)
(no submission)
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 service-side
session.
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:
Copyright © 2022 Upsorn Praphamontripong
Released under the
CC-BY-NC-SA 4.0 license.
Last updated 2022-06-02 20:32