11) Validate Email

Now, when the Send button is pressed, the submitForm variable will evaluate as true in the evaluateForm function, and we can work our magic by calling the sendMail command using the parameters set in the $_POST array by the HTML form:

echothanks

But, before calling the sendMail function, let’s make sure that the email address is valid by using one of the built-in filters:

validate email

php.net/manual/en/function.filter-var.php

We’ll create the sendMail function in the next post. This is the evaluateForm function so far:

evaluate

The echo command is a  PHP  language construct that outputs the text strings. The text strings will appear with the form, anyplace the active shortcode is being used.

BTW, it might also be important to filter the other text fields from passing malicious code.

Advertisements