Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is php class In this exercise, you will create a single PHP file to display and process a form that is a working Contact

This is php class

In this exercise, you will create a single PHP file to display and process a form that is a working Contact Me page. This page will have inputs for the subject, the senders name, the senders e-mail address, and the message. The form will also send a copy of the message to the sender.

All the code required to make a functioning Contact Me PHP script is provided. You are required to type up all the code below. Then add comments into the code ( // or /* .... */) to fully explain it. Each function should be individually explained.

1. Create a new document in your text editor. Type the declaration, element, header information, and

element. The page title should be Contact Me.

2. Add the opening and closing tags for the PHP script section in the body of the document:

image text in transcribed

3. Add a function called validateInput() within the php tag. This function takes two parameters. The first parameter, $data, is a string to be validated. The second parameter, $fieldName, is the name of the form field. The function returns the $data parameter after it has been cleaned up.Notice that the function uses the global variable $errorCount.

image text in transcribed

4. Add a function called validateEmail() immediately after the validateInput() function. This function is almost exactly like the validateInput() function, but it adds a filter_var() (Links to an external site.)Links to an external site.test to validate that the entered e-mail address is in the correct format.

image text in transcribed

5. Add a function called displayForm() immediately after the validateEmail() function. This function takes one parameter for each form field and displays the form. It uses the parameters for sticky form functionality.

image text in transcribed

6. Immediately after the displayForm() function, declare and initialize a set of variables as follows:

image text in transcribed

7. Next, add the following code to check for and validate the input. Note that $_POST['Email'] is checked with the validateEmail() function instead of the validateInput() function.

image text in transcribed

8. Next, add a conditional statement that checks the value of $ShowForm. If $ShowForm is TRUE, the form is displayed. Otherwise, an e-mail message is sent and a status message is displayed. Note that a copy is sent to the sender.

image text in transcribed

php

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

lets look at the PATH enviorment variable

Answered: 1 week ago

Question

What are important steps for couples recovering from infidelity?

Answered: 1 week ago

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago

Question

Describe the seven standard parts of a letter.

Answered: 1 week ago

Question

Explain how to develop effective Internet-based messages.

Answered: 1 week ago

Question

Identify the advantages and disadvantages of written messages.

Answered: 1 week ago