7) Add Shortcode


When the shortcode [zapform] is found in a post or page or even in the text field of a widget, the function evaluateForm is executed.


In the evaluateForm function, the value of one element of the $_POST array, submitForm, is tested to see if it’s been set with a value. $_POST(‘submitForm’) will be set to a value by the Submit button of the HTML form we are about to add. The $_POST array gets filled with values from the form because we are using the POST method. (The other method possible to use is the GET method.)

So far, the submitForm value has not been set, so the only thing that happens at first is the other four array values get initialized.

Next we’ll add a line of code to include the HTML file.