Final Project Instructions Workflow When the user clicks the submit button on the add contact form each text field will be validated. The validation will check for proper formatting and if the field...

Final Project Instructions

Workflow


When the user clicks the submit button on the add contact form each text field will be validated. The validation will check for proper formatting and if the field is blank (no fields can be blank). If a field is valid then no error message is shown, if a field is not valid then an error message will be shown above the field entry box. If there is an error for any of the fields, all the fields entries will be preserved.


Also, for the checkboxes, dropdown select box, and radio buttons their state (checked/selected or not checked/not selected) will be preserved. If the user does not select an age range, they will get a message stating that they must select an age range. The checkboxes are optional and can be selected or not.


If there are no errors, then the form field data will be put into a database and a message will appear at the top of the form reading, "Contact has been added". If there is a problem with adding the record but all form field validation is done, then a message will display reading, " There was an error adding the record".


If a user clicks the link "Display All Contacts Information" they will be taken to a page that will display all the records in the database. If there are not records in the database, then a message will appear stating "There are no records to display" These records will be displayed in a tabular format (see screenshot). There will be a checkbox at the end of each row. If the user checks one or more checkboxes and clicks the delete button records checked will be deleted and a message will display reading "Contact(s) deleted". If the application was not able to delete the records then a message will be displayed "Could not delete the names" If the user does not check the checkboxes but clicks the delete button the page will reload but nothing will be deleted.


Project Specifications and Requirements


You are to create a form and display records page that look like the screenshots (Yes you must use Bootstrap).


You are to create a single table database named “final_project” to hold all the records.


You will have six text fields; each field will have its own validation criteria. Fields and criteria are shown below.


Name – alpha characters (upper and lower case), hyphens, apostrophes, spaces only (cannot be blank). Address – start with a number, then alpha characters, spaces, hyphens, and periods (cannot be blank). City – Must be alpha characters only. Phone – Must be in the format 999.999.9999, where 9 is a digit of 0 to 9 (cannot be blank). Email address – Valid email address (cannot be blank). DOB – mm/dd/yyyy should format to a proper date (cannot be blank).


In addition, you will create one select drop down box that will contain 5 states. It must be sticky as well so if the user selects a state and there is an error on the form that selection will remain.


Finally, you will create three checkboxes and four radio buttons. If a radio button is not selected, then after the submit button is clicked a message will appear displaying the following text “You must select an age range”.


The regular expressions for phone can accept all zeros or other bad combinations. If you want to write a regular expression better that what is expected that is fine. Also, feel free to look the regular expressions up on the Internet, you do not have to write them from scratch.


The page in which the form will appear will be an index.php page. The actual form and other logic will be in a folder named “php” and the form file will be named “form.php”. This file will be used when the appropriate parameter is passed to the URL as shown (your ip address will be different):


http://198.199.80.235/cps276/cps276_assignments/assignment10_final_project/solution V2/index.php?page=form In the same folder named “php” you will have another file named “displayRecords.php” this file will be used when the appropriate parameter is passed to the URL as shown (your ip address will be different).


http://198.199.80.235/cps276/cps276_assignments/assignment10_final_project/solution V2/index.php?page=display If you enter the URL to just the index page (without the parameter) or to the wrong parameter, the user will be redirected to the form page The index.php file is used to display both the form file and the display records file.


I have provided an assets file that has all the required classes to use and the folder file structure I am looking for. This a starting point.


You will need to do the following: • Update the Validation Class (adding regular expressions).


• Write all the code for the form.php and displayRecords.php files found in the php folder. You need to use the classes I provided or write your own. If you use my StickyForm class you must make sure to write the associative array correctly. Please refer to the documentation found on my github site. If you create your own database classes you must us the PDO library. https://github.com/sshaper/cps276_examples/tree/master/php-form-validation • For how to do the check boxes and the delete of records you can refer to my github site https://github.com/sshaper/cps276_examples/blob/master/phppdo/classes/Crud.php • Add the code to the index.php page (at the top) so it will call the appropriate file when the correct URL parameter is passed. • When submitting this please make sure to have some test information in each text field. • IMPORTANT NOTE: This is not an AJAX assignment no JavaScript will be used in this project. Doing so will result on a failing grade.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here