Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Visual Basic Expert

Chapter 12 - Error Handling and Validation

Instructions: Update the PHP file (i.e. ROakley_A4.php) so that it accomplishes all steps. Submit the PHP file and the 3

screenshots of the form in D2L in the Assignment 4 Dropbox. PHP section

1. Create the following variables to store error messages. Set all variables equal to an empty string. Set siteError equal to

(zero) 0.

Variable names

nameError

name

commentError

email

emailError

comment

statusError

status

siteError

2. Write PHP code that will check to see if the request method used is POST.

If that is true, then the user has submitted data that needs to be validated.

3. Write the PHP code to check the name field. If it is empty, set name variable to "Full Name is Required" & set siteError

variable to 1.

If the name field is not empty, set the name variable to the data the user entered then validate that it is in the proper format.

Set nameError variable to "Only letters and white spaces allowed" if it is not in the proper format.

(HINT: the data the user entered is store in $_POST["fieldname"] where fieldname is the field of interest.)

4. Write the PHP code to check the email field. If it is empty, set email variable to "Email is Required" & set siteError variable to 1.

If the email field is not empty, set the email variable to the data the user entered then validate that it is in the proper format.

Set emailError variable to "Invalid email format" if it is not in the proper format.

5. Write the PHP code to check the comment field. If the comment field is empty, set commentError variable to "Comment to

Advisor is Required" & set siteError variable to 1. If the comment field is not empty, set the comment variable to the data the

user entered.

6. Write the PHP code to check the status field. If the status field is empty, set statusError variable to "Academic Status is

Required" & set siteError variable to 1. If the status field is not empty, set the status variable to the data the user entered.

7. Write the PHP code to check if the siteError variable is not equal to 1 (which indicates there are no error messages present).

If this is true, display all the data that was received from the user, else display the following error message "There is an error!

Check your input."

HTML section

8. Edit the HTML code of the form to include placeholders which give the user prompts in the browser.

9. In the PHP sections within the HTML code, echo out the appropriate comment variables as indicated.

10. Test your code and take 3 screenshots of the form:

a. Before any data is submitted

Note that the user-entered data is bolded!!

b. When no data or incorrect data is entered

c. When correct data is entered Chapter 12 - Error Handling and Validation

Instructions: Update the PHP file (i.e. ROakley_A4.php) so that it accomplishes all steps. Submit the PHP file and the 3

screenshots of the form in D2L in the Assignment 4 Dropbox. PHP section

1. Create the following variables to store error messages. Set all variables equal to an empty string. Set siteError equal to

(zero) 0.

Variable names

nameError

name

commentError

email

emailError

comment

statusError

status

siteError

2. Write PHP code that will check to see if the request method used is POST. If that is true, then the user has submitted data

that needs to be validated.

3. Write the PHP code to check the name field. If it is empty, set name variable to "Full Name is Required" & set siteError

variable to 1. If the name field is not empty, set the name variable to the data the user entered then validate that it is in the

proper format. Set nameError variable to "Only letters and white spaces allowed" if it is not in the proper format.

(HINT: the data the user entered is store in $_POST["fieldname"] where fieldname is the field of interest.)

4. Write the PHP code to check the email field. If it is empty, set email variable to "Email is Required"

& set siteError variable to 1. If the email field is not empty, set the email variable to the data the user entered then validate

that it is in the proper format. Set emailError variable to "Invalid email format" if it is not in the proper format.

5. Write the PHP code to check the comment field. If the comment field is empty, set commentError variable to "Comment to

Advisor is Required" & set siteError variable to 1. If the comment field is not empty, set the comment variable to the data the

user entered.

6. Write the PHP code to check the status field. If the status field is empty, set statusError variable to "Academic Status is

Required" & set siteError variable to 1. If the status field is not empty, set the status variable to the data the user entered.

7. Write the PHP code to check if the siteError variable is not equal to 1 (which indicates there are no error messages present).

If this is true, display all the data that was received from the user, else display the following error message "There is an error!

Check your input."

HTML section

8. Edit the HTML code of the form to include placeholders which give the user prompts in the browser.

9. In the PHP sections within the HTML code, echo out the appropriate comment variables as indicated.

10. Test your code and take 3 screenshots of the form:

a. Before any data is submitted

Note that the user-entered data is bolded!!

b. When no data or incorrect data is entered

c. When correct data is entered

 

Visual Basic, Programming

  • Category:- Visual Basic
  • Reference No.:- M91600227
  • Price:- $60

Priced at Now at $60, Verified Solution

Have any Question?


Related Questions in Visual Basic

Pitch amp game design documentthe assignment is about

Pitch & Game Design Document The assignment is about educational driver for teenagers Assignment Brief: In groups you will: - present a pitch and produce a one sheet - provide a demonstration of your game - produce a hig ...

Assignment frans virtual fruit standfrans virtual fruit

Assignment: Fran's Virtual Fruit Stand Fran's Virtual Fruit Stand is an online store that sells several types of dried fruit. Based on the needs of Fran's Virtual Fruit stand, you must design a flowchart using Visual Log ...

Please show how to do the belowvisual basic net application

Please show how to do the below: Visual Basic .NET Application - Coding Exercise 1 (Exercise 13, Zak, 2016, p. 347) For this coding exercise, write the Visual Basic code for a pretest loop that uses an Integer variable n ...

Assignment virtual storeuse the concepts and scenario from

Assignment: Virtual Store Use the concepts and scenario from Assignment 1 to help "Your" Virtual Business to increase the functionality of its online shopping cart. When a customer checks out, the shopping cart must stor ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As