Lab 8 - Forms and Session State
Lab 8 - Forms and Session State
Purpose
• Forms
• Various ‘input’ Tags
• Session State
• Upload your website to a Web server
Due Date
Assessment
• This Lab is worth 3% of your total course mark.
Assigned Readings
➢ Lecture Slides posted on Brightspace
• Module 4 -> Part 1
➢ The following chapters of Fundamentals of Web Development will be useful in
completing this exercise:
• Chapter 4
• Chapter 13
Lab Supplies
To complete this lab you will require the following lab supplies:
• Lecture Slides (Module 4 -> Part 1) and Code Examples (Form and Session State Code
Examples.zip) posted on Brightspace
• Textbook: Fundamentals of Web Development by Randy Connolly and Ricardo Hoar
• EasyPHP, or other WAMP server
• Eclipse, Notepad (or other text editor, or IDE)
Summary of Tasks
1. Develop the logic to display your web application
2. Upload your website to the webserver
3. View your webpage using a web browser
4. Submit Lab Link on Brightspace
5. Submit Source Code of all PHP files on Brightspace
Task 1
Implement the following Design Pattern to create a ‘Common Look and Feel’ to be used
on every page of your website.
NOTE: Input.php, Session1.php, Session2.php all must include the Common look and feel
implemented in Header.php, Footer.php and Menu.php.
Header.php
Header.php must contain a script to display a Common Header that will appear on every page.
The header must display Program Name and Course Name.
Footer.php
Footer.php must contain a script to display a Common Footer that will appear on every page.
The footer must contain Student Number, First Name, Last Name, and Email Address
Menu.php
Menu.php must contain a script to display a Common Menu to be show on every page. The
menu must contain links to Input.php, Session1.php and Session2.php
Input.php
Create a PHP script that will perform the following tasks:
1. Divide the content area of this page into two sections (Side by Side)
2. On the left side: create a form that accepts the following information from the user
a. Text box, First Name
b. Text box, Last Name
c. Text box, Phone Number
d. Radio Button List, with the values Staff, Student and Faculty
e. Select, a select box that lists 4 Game: Hockey, Basketball, Soccer, Tennis
f. Submit button with the text ‘Submit Information’
3. On the right side: When the user clicks ‘Submit Information’ gather all the information
from the form on the left side and display the results on the right side
Session1.php
Create a PHP script that will perform the following tasks:
1. Implement the same form listed in Input.php, Part 2
2. This time, when the user clicks ‘Submit Information’ , store all the information gathered
from the form in the Session State
3. Automatically Redirect the user to Session2.php
Session2.php
Once the user is forwarded to Session2.php, display the results of the information gathered in
the form on Session2.php
Task 3
Upload your websites for Lab 8 into a Web Hosting Server by uploading ‘Lab8’ folder inside the
‘public_html’ directory of ‘SiteGround’ Web Hosting domain using DashBoard.
The ‘File Upload’ instruction is posted on Brightspace (Course Contents -> Module 1 -> Part 2 ->
SiteGround_FileUpload_Instruction.docx).
Task 4
View your websites for Lab 8 using a web browser. Open a web browser and navigate to the
following web address:
http://your_web-hosting_domain_name/Lab8/<filename>
For example, the sample URL for Lab 8 on an arbitrary web hosting domain is:
rejaulc.sgedu.site/Lab8/Input.php
where ‘rejaulc.sgedu.site’ is the name of an arbitrary web hosting domain, ‘Lab8’ is the
submission folder for Lab 8, ‘Input.php’ is the homepage of Lab 8.
Task 5
Once you have confirmed that your webpage is available online, you are ready to hand in your
lab.
Create a compressed file (Lab8.zip) which will contain the following PHP files:
• Header.php
• Footer.php
• Menu.php
• Input.php
• Session1.php
• Session2.php
(N.B. Please keep in mind that ONLY .zip file is accepted as the format of the compressed file.)
Create a word document (Lab8.doc) in which write the following Information:
• Student Number
• First Name
• Last Name
• The URL, or hyperlink of the home page (Input.php) of Lab 8
To hand in your lab, go to Brightspace and navigate to Course Content → Labs and click on ‘Lab 8
– Forms and Session State’ link. Upload the word document (Lab8.doc) and the compressed file
(Lab8.zip) on Brightspace. Finally, click the ‘Submit’ button to send the lab to your professor.
IMPORTANT NOTE:
If the URL, or hyperlink, does not direct the professor to the lab you will receive a ZERO for the
lab assignment.
IMPORTANT NOTE:
If you do not upload either Lab8.zip or Lab8.doc on Brightspace, you will receive a ZERO for the
lab assignment.