Threesuns

Email

Contact

All Semesters

Semesters

All Courses

Courses

PHP Programming (Blended)

CSYS2463

3 credits

Labs

Simple Contact Form

Lab

100 points

Requirements

Comments placed in the source code file5
Form is displayed and useable5
Both pages in lab are templatized using require function10
Errors in the form are recognized and the user is informed of errors in a friendly manner25
User does not need to reenter information when form is not valid15
User info is written to and read from a flat file20
Administration form displays contacts requested as specified15
Administration form allows for requests to be removed from the list5
Total100 pts

Objective

Practice using functions and regular expressions

Instructions

For this lab you will start a new website for an imaginary company. You should begin by creating a site design and layout for this new company that you will then use on all of the pages created for the company by requiring them for each page with PHP.

You will next need to create a contact form for the company that a customer would use to request a contact. The form should include text fields for the customers first name, last name, phone number, email address, and should contain radio buttons that allow the user to choose their preferred form of contact (phone or email). PHP functions and regular expressions should be used to confirm that each field is complete and appear to contain correct information (names cannot have numbers in them, email address appears to be valid, phone number is in the proper format). If a field is found to not be complete or correct an error message should be shown to the user on the page containing the form and the offending fields should be highlighted in some way to draw the customers attention to them.

When the form is complete and correct the information collected from the form should be written to a flat file. Many requests for contacts could exist in this file at any time but we will assume that only one person will be accessing the file at a time.

A contact administration page should next be created that would allow a person in the company to view the requests for contact that are stored in the flat file as a nicely formatted webpage showing all of the information that the users entered into the form except their contact type preference (phone or email). Instead, if the customer preferred being contacted by email then the persons email address should be shown in bold, if they preferred phone, then their phone number should be shown in bold. Each contact request in the list should have a checkbox displayed with it that the employee could check and submit to inform the system that they have completed the requested contact, and that contact should be removed from the flat file and the list and the page should be refreshed for the employee only showing the remaining contact requests.