What this "Master Form .PHP" Software Does
When information is stored in a MySQL database, it is stored in what is called a "table." Here is a visual representative of how "Master Form .PHP" might set up a MySQL database table for form fields.
Column names represent form field names.
Each row is a record of a form submission.
+==========+===================+===================+
|name |email |comment |
+==========+===================+===================+
|Will |will@example.com |This is kinda neat |
+----------+-------------------+-------------------+
|Joe Far |jofar@example.com |Sweet stuff, Will! |
+----------+-------------------+-------------------+
|Keystroke |dadude@example.com |Klackin' along :) |
+==========+===================+===================+
Fast Setup
For really fast setup, do the following two steps.
Step 1. The confirmation/thank-you page
The confirmation/thank-you page needs to be a PHP web page. In the confirmation page source code, insert this PHP code:
Insert the PHP code in the head area of the web page source code, if you can. Otherwise, as high in the body area as is feasible.
The higher in the source code the PHP code is inserted, the better. Any later confirmation/thank-you page customization can occur only below the point where the line is inserted.
Step 2. The form
The web page with the form can be any standard type of web page – .html, .php, .asp, etc. PHP is not required.
Use the URL of the confirmation/thank-you page for the <form... tag's action= attribute.
Example:
<form
method="post"
action="http://example.com/confirmation.php">
(For Later) Downloading MySQL Table Data
Any time after the form has been used, click the "Download Table Data" menu link to download form information recorded in the MySQL database.
The download is CSV formatted.
Quick Start
The quick start bypasses the Master Form .PHP control panel. The form submission information will be stored in the default MySQL database table.
(Later, if you want required fields or have email sent or other custom things, a table setup will need to be created in the Master Form .PHP control panel.)
The quick start is two steps.
Step 1. The confirmation/thank-you page
It might be counter-intuitive, but do the confirmation/thank-you page first.
The confirmation/thank-you page needs to be a PHP web page. In the page source code, insert this PHP code:
<?php
$InstallationDirectory = "/installed";
include($_SERVER["DOCUMENT_ROOT"]."$InstallationDirectory/MasterFormInclude.php");
?>
Insert the PHP code in the head area of the web page source code, if you can. Otherwise, as high in the body area as is feasible. Any customization related to the form submission can occur only below the point where the line is inserted.
Put the confirmation/thank-you page on your server. Make a note of its URL. (The URL will be needed at the end of Step 2.)
Step 2. The form
The web page with the form can be any standard type of web page – .html, .php, .asp, etc. PHP is not required.
Create your form, if you don't already have one.
Paste the form's source code into a text processor and do two things:
-
Replace the <form...> tag with this code:
<form
id="myform"
method="post"
enctype="multipart/form-data"
action="http://example.com/formpage.php">
The id value may be changed.
The method value may be changed to "get". For most implementations, "post" is preferred.
The enctype attribute may be optional. If the form has a file upload field, the enctype attribute is required.
Make the action value the URL of the web page with the form.
Note: If the web page with the form is a PHP web page, the action URL can be inserted automatically with:
action="<?php echo($_SERVER['PHP_SELF']); ?>"
-
Below the form code (below the cancel </form> tag), insert this JavaScript:
<script type="text/javascript">
var formTagID = "myform";
var confirmationPage = "http://example.com/confirmation.php";
document.getElementById(formTagID).action=confirmationPage;
</script>
If the form's id value is different than id="myform", change the formTagID value in the above JavaScript accordingly.
Replace the conformationPage value in the above JavaScript with the URL of the conformation/thank-you page set up in Step 1.
Put the web page with the form on your server.
Quick Start is now complete. The form is ready to use.
More
For more and advanced information about using "Master Form .PHP", click the "User Manual" menu link.
Menu —