Question: 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:

This is php class In this exercise, you will create a single

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.

PHP file to display and process a form that is a working

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.

Contact Me page. This page will have inputs for the subject, the

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.

senders name, the senders e-mail address, and the message. The form will

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

also send a copy of the message to the sender. All the

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.

code required to make a functioning Contact Me PHP script is provided.

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.

You are required to type up all the code below. Then add

php

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Sure heres a PHP script for a Contact Me page with explanatory comments php DOCTYPE html ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!