Lab 7

For this lab you will create a ContactPage and a ContactForm class that will include the following features.

contact.php

You will generate a Contact Page given by the inclass example PageLib.php. Create a ContactPage class that extends Page object. The ContactPage class will have a public member variable $form assigned to a new ContactForm object by default, which you will define a class in a seperate file called ContactFormLib.php and require within this ContactPage.php. Override the Page's displayPage() function such that you will call a member function displayContactForm passing it's member variable form. Within this function you will call the ContactForm object's member function displayForm().


ContactFormLib.php

You will create a class called ContactForm that will contain a member variable for action='contact.php' and method='POST' four member functions: addLabel, addInput, addTextArea, and displayForm.


Once the form has been submitted [if(isset($_POST))] validate that all the required fields were not empty. If so, assign the $contactpage's member variable content to display "Thank you ... $name, $email, $phone, and $message". Otherwise display the form.



Put all of these scripts into your ~/3680_S18/wk7/ depository directory, which I'll extract and copy all of them at the time of the due date.