1. Download the script's zip file to your computer and extract it.
2. Use notepad, or any simple text editor, to open file: 2m-formmail.php
3. Read through the header of the file and write the correct values for some of the parameters (check the file, it's easy to edit).
4. Upload the modified 2m-formmail.php file, the simple-form.html and the scripts folder (including its contents) via FTP to anywhere inside your /public_html file.
5. Run the script by pointing the browser to simple-form.html
Can I add more form fields inside simple-form.html ?
Yes, you can add as many fields as you want inside the <FORM> tag in simple-form.html (text areas, radio buttons, etc.).
If you used Class = 'required' in the input tag, the form item will be treated as a required item--it's that simple.
Example for a required text field:
<input type="text" name="example" class="required" value="">
Example for a required text field and verify user input as an email address:
<input type="text" name="email1" class="required email" value="">
How to use 2m-formmail.php with your existing form
If you already have a custom-made form, you can simply point it to 2m-formmail.php by modifying its FORM ACTION html code and using the POST method.
< Form action='2m-formmail.php' method='POST'>
The PHP script will handle ANY form; nothing more is required in the html form.
To use the form validation with your own form:
Copy and paste the following code from the header of simple-form.html (included in the download file)
- Be sure to include jquery.js and jquery.validate.pack.js (in the scripts folder) in your HTML form
- Be sure include the CSS code to style the error message
- Make your formmail ID "2mFormMail"
- Add the document ready function
Now you are ready. If you used Class = 'required', the form item will be treated as a required form.
You can even set more rules for form validation:
For more info, please read the Jquery Validation page.