Software, your way.
How To Get Good Custom Software
(Download)
(PDF)
burger menu icon
WillMaster

WillMaster > LibraryOur Software in Action

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

WordPress with Master Form .PHP

Master Form .PHP is sophisticated form handling software with automatic submission protection. A short list of its features is further below.

I'll describe how to integrate Master Form .PHP forms into WordPress posts and pages.

The first thing to do is install Master Form .PHP. Nothing special here. Just follow the short instructions. (If you need help with this, use the Contact link found at the top-right of most Willmaster.com pages.)

The reason this is a normal installation is because Master Form .PHP and WordPress run separately. Only the page with the form and thank-you page are part of WordPress. Even the MySQL tables are separate.

At this point, let me provide a short list of Master Form .PHP features. Then, I'll describe how to integrate its forms into WordPress.

  1. Security. It has cross-site scripting protection (XSS attacks), which is important. Other protection also can be turned on in the Master Form .PHP control panel.

    I have 15 years experiencing writing software for websites. Security is a large part of my focus.

  2. Spam protection. The automated form submission protection doesn't use the annoying visual CAPTCHA things. Instead, it uses JavaScript. Additional protection comes from the ability to ban certain IP addresses, email addresses, or words/phrases.

  3. Versatile. Master Form .PHP can handle most forms, including multi-page forms and forms with file upload fields.

  4. MySQL. Form submissions are stored in a MySQL database where they can be referred to in the future.

  5. Emails. One, none, several, or many emails can be sent with every form submission. HTML or plain text. Email may have attachments.

Integrating a Form into WordPress

We're going to do this in backward order.

  1. The thank-you page, a WordPress post or page.

  2. The submission page (which needs to know the URL of the thank-you page).

  3. The form (which needs to know the URL of the submission page).

  4. Integrating the form into a WordPress post (which needs to know the URL of the form).

These instructions assume the Master Form .PHP software is installed on the server. If it isn't, do so now.

Here are the steps to integrate a Master Form .PHP form into WordPress.

  1. The thank-you page.

    This is a WordPress post or page with "Thank you. We'll get back to you" or other message appropriate for your installation, perhaps with information about other pages of interest.

    Note the URL of the thank-you post or page. It will be needed in the next step.

  2. The submission page.

    The submission page is where the form will be submitted to. Part of the security of Master Form .PHP is that the forms never submit directly to the software.

    The submission page is a file independent of WordPress. So make a separate directory where the file can be put. These instructions assume the separate directory is named "formdirectory".

    Create a blank file with a .php file name. This will become the submission page. These instructions assume the submission page is named "formsubmission.php".

    In the Master Form .PHP control panel, click the "User Manual" button and the "Quick Start" link. Copy the 4 lines of the confirmation/thank-you code and paste it into the blank submission page, formsubmission.php

    The 4 lines of code looks something like this.

    <?php
    $InstallationDirectory = "/php/mfphp";
    include($_SERVER["DOCUMENT_ROOT"]."$InstallationDirectory/MasterFormInclude.php");
    ?>
    
    

    Below the 4 lines of code, paste this additional line of code:

    <?php header('Location: /THANK-YOU-PAGE-URL/'); ?>
    
    

    Replace THANK-YOU-PAGE-URL with the URL of the thank-you page created in step 1.

    The entire content of the submission page, formsubmission.php, will then be something like this, except with your custom information:

    <?php
    $InstallationDirectory = "/php/mfphp";
    include($_SERVER["DOCUMENT_ROOT"]."$InstallationDirectory/MasterFormInclude.php");
    ?>
    <?php header('Location: /THANK-YOU-PAGE-URL/'); ?>
    
    

    Upload the submission page to your server and make a note of its URL. The URL will be used in the next step.

  3. The form.

    As part of its security, every form must have an associated setup in the Master Form .PHP control panel. (Form setups may have multiple forms associated with it.)

    If you haven't done so already, create a form setup for the form you'll be using with your WordPress site. To do so, go to the Master Form .PHP control panel and click the "Create Form Setup" button. The control panel menu has a "Manual" button leading to step-by-step information.

    When the form has been created, the form code needs 3 special things:

    1. The value of the form tag's action URL needs to be a period or blank. The entire form tag might look like this.

      <form
         id="myform"
         action="."
         method="post">
      
      
    2. Insert the custom hidden field for the form setup.

      To get the custom hidden field code, click the dropdown list of the Master Form .PHP control panel and select the relevant form setup. Then click the "Get Setup Info" button. The code for the hidden field will be on that page.

      The hidden field will look something like this.

      <input 
         type="hidden" 
         name="MySQL_table_key" 
         value="1">
      
      
    3. Below the form, somewhere below the cancel form tag </form>, paste this JavaScript. (Customization notes follow.)

      <script type="text/javascript">
      var formTagID = "myform";
      var confirmationPage = "/SUBMISSION-PAGE-URL/";
      document.getElementById(formTagID).action=confirmationPage;
      </script>
      
      

      Customization notes:

      If your form tag's id value is not "myform" then, at line 2 of the above JavaScript, replace "myform" with your form tag's id value.

      At line 3 of the above JavaScript, replace "/SUBMISSION-PAGE-URL/" with the URL of your submission page.

    Save the form page with any file name that makes sense to you. These instructions assume the form file is named "formcode.html".

    Upload the formcode.html into the directory containing the submission page. Make a note of its URL. It will be used in the next step.

  4. Integrating the form into a WordPress post.

    This requires our Local Syndication plugin.

    In the WordPress dashboard, go to Plugins | Add New. Then search for "Local Syndication". Install and activate it.

    In the post or page where you want the form to be published, insert this shortcode:

    [syndicate_local url="/FORM-PAGE-URL/"]
    
    

    Replace /FORM-PAGE-URL/ with the URL of the form page formcode.html (or other file name it was saved as).

If you have any questions or would like help with installation or other aspects of Master Form .PHP, use the Contact link at the top-right of most Willmaster.com pages. We support all of our software.

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC