I need the code of the visual studio and for the questions
Introduction
In this lab, you will create an object-oriented form processor
with input validation. You need to validate different types of
input. In doing so, you should use the PHP filter extension for
validation whenever possible.
Requirement
1. Make sure to put your name and student ID in the top comments
of all your files
2. All the functions need to be coded in their respective
include files. You need to make sure that all the definitions in
the config.inc.php is correct. Make sure to require this file first
in the main file.
3. You can not change the function signature in the include
files
4. You must validate all input submitted by the user
5. The third input, i.e., the student ID number, needs to be
filtered using the following regexp /^\d{3}[\s]?\d{4}$/
6. The international student status option needs to be validated
such that at least one of the option, i.e., yes or no, is
checked
7. For the select program, the input needs to be validated that
at least one answer is chosen
8. The number of years input must be filtered with INT range
validation such that its value ranges from 1 to 6
9. The number of courses input must be filtered with INT
validation
Include files
config.inc.php – The place where you put all
the definitions and the php.ini runtime setting to enable custom
logging
HTMLPage.class.php – A class that has all the
static methods to display the page. Please see studentPage.html as
the guide to create the methods in this file
ValidatePage.class.php – A class that validate
the user’s inputs form. Any error from any method in this class
will update the Validate::$validation_result array. It is up to you
on how to design the $valid_status array. The easiest one is to
create it as an associative array such that when an input is not
valid, a new entry to the array with the form input name as key and
its corresponding error message will be added to the array
Functions
ValidatePage class
validateInput() –Validates the submitted data
and update the validation_result array
HTMLPage class
displayHeader() – Display the upper part of the
html page. Set the title and body’s heading.
displayFooter() – Display the bottom part of
the html document
displayForm($validation_result) – Display the
form. Use the $valid_status updated by the validateForm() to check
whether the specific input has valid entry or not. Hint: you need
to use both empty() and isset() functions
displayErrorMessage($validation_result) –
Display the error messages
displayThanks() – Display thank you
messages
displayData() – Display the submitted data.
Remember $_POST is superglobal
Figure 1: The empty form Assignment 2: Form Processing by Bambang -- 1234567 Douglas Student Info Page Full Name First and last name Email Address [email protected] Student ID XXXXXXX International Student? O Yes O No Program Please select one option Number of Years at Douglas number of years less than 7 Number of Courses Taken number of courses taken Submit Information Clear Data The student's name and ID should be printed in the heading. These values should be defined as constant in the inc/config.inc.JDo56789.php file
Figure 2: The form was submitted without any input data (notice the error messages) Assignment 2: Form Processing by Bambang -- 1234567 Douglas Student Info Page Please fix the following errors: • Please enter a valid name. Full Name • Please enter a valid email address. First and last name • Please enter a valid 7 digits student ID. • Please choose the international status. Email Address • Please select one of the computing sciences programs! [email protected] • The number of years should be between 1 until 6 Student ID • The number of courses should be integer XXXXXXX International Student? O Yes O No Program Please select one option Number of Years at Douglas number of years less than 7 Number of Courses Taken number of courses taken Submit Information Clear Data
Figure 3: Some inputs were valid The regexp provide in the instruction above can handle the following pattern: 1234567, and 123 4567. When a user entered the Full Name and email address correctly but did not put a valid student ID number, notice the error messages and also the fact that only the correct values are being printed within the html inputs. Assignment 2: Form Processing by Bambang -- 1234567 Douglas Student Info Page Please fix the following errors: • Please enter a valid 7 digits student ID. Full Name • Please choose the international status. Joe Douglas • Please select one of the computing sciences programs! • The number of years should be between 1 until 6 Email Address • The number of courses should be integer [email protected] Student ID XXXXXXX International Student? O Yes O No Program Only the correct/validated values are Please select one option Number of Years at Douglas being printed within the html inputs: Full Name and Email Address number of years less than 7 Number of Courses Taken number of courses taken ► P U8 P E EL A ✓
Assignment 2: Form Processing by Bambang -- 1234567 Douglas Student Info Page Please fix the following errors: • Please enter a valid 7 digits student ID. Full Name • Please choose the international status. Joe Douglas • Please select one of the computing sciences programs! • The number of years should be between 1 until 6 Email Address • The number of courses should be integer [email protected] Student ID XXXXXXX International Student? O Yes O No Program Please select one option Only the correct/validated values are being printed within the html inputs: Full Name and Email Address Number of Years at Douglas number of years less than 7 Number of Courses Taken number of courses taken Submit Information Clear Data
Figure 4: Most of the inputs were valid When the user enters valid data for most of the inputs, except for the number of years, notice the error message, the printed values within the html inputs and the checked/selected options. Assignment 2: Form Processing by Bambang -- 1234567 Douglas Student Info Page Please fix the following errors: • The number of years should be between 1 until 6 Full Name Joe Douglas Email Address [email protected] The correct/validated values are printed within the html inputs. Student ID 1234567 International Student? One of the radio buttons were checked Ⓒ Yes O No Program Emerging Technology One of the select options were selected Number of Years at Douglas number of years less than 7 Number of Courses Taken The correct/validated values are printed within the html inputs. Submit Information
Assignment 2: Form Processing by Bambang -- 1234567 Douglas Student Info Page Please fix the following errors: • The number of years should be between 1 until 6 Full Name Joe Douglas Email Address [email protected] The correct/validated values are printed within the html inputs. Student ID 1234567 International Student? One of the radio buttons were checked Yes O No Program Emerging Technology One of the select options re selected Number of Years at Douglas number of years less than 7 Number of Courses Taken The correct/validated values are printed within the html inputs. Submit Information Clear Data
Figure 5: When the valid data are entered: the notification message and submitted data are displayed Assignment 2: Form Processing by Bambang -- 1234567 Thank you for your input. Entered data is: Name Joe Douglas Email [email protected] Student ID 1234567 International Student Status yes Program Emerging Technology Number of Years 3 Number of Courses 8
I need the code of the visual studio and for the questions Introduction In this lab, you will create an object-oriented
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am