Form Configuration



The action of your form needs to point towards the PHP FormMail script (obviously), and the method must be POST.

Description: Opening Form tag.
Example:<form method="POST" action="formmail.php">

Required Form Fields



There is only one form field that you must have in your form, for PHP FormMail to work correctly. This is the recipient field.
Field:recipient
Description: This form field allows you to specify what email address you want your form results to be mailed. You may specify multiple recipients by including multiple email addresses, seperated by commas.
Example:<input type="hidden" name="recipient" value="email@example.com">

Optional Form Fields

Field:subject
Description: The subject field allows you to specify the subject that will appear in the results email that is sent. If you do not specify this option, then the script will default to a message subject of:
Form Submission
Example:If you wish to choose what the subject is:
<input type="hidden" name="subject" value="Your Subject">

To allow the user to choose a subject:
<input type="text" name="subject">

Field:email
Description:The email field will be used in the From: field of the results email that is sent. This allows you to reply to form users by simply replying to the results email.
Example:<input type="text" name="email">

Field:cc_email
Description:If the cc_email field is set to 1, the form data will be Carbon Copied to the email address filled out in the "email" field (this field will not do anything if the "email" field is not used, or is left blank by the person filling out the form).
Example:<input type=hidden name="cc_email" value="1">

Field:redirect
Description:The redirect field allows you to send users to a custom results page, instead of seeing the default message.
Example:<input type="hidden" name="redirect" value="http://www.example.com/example.html">

Field:required
Description:The required field allows you to specify fields that must be filled in for the form to be successfully submitted. If any of the required fields are left blank, an error message will be diplayed with a link back to the form and instructions to complete all required fields. You may specify multiple fields by including multiple field names, seperated by commas.

To specify a customized error page, see missing_fields_redirect.
To specify a customized error message, see missing_fields_message.
Example:<input type="hidden" name="required" value="email,name">

Field:env_report
Description:Allows you to have Environment variables included in the results email that is sent. Useful if you wish to know what browser they were using, what IP and/or PORT they were coming from or what the url of the form they filled out was. The following is a list of currently supported environment variables that might be useful:

REMOTE_ADDR     - The IP address of the user filling
                  out the form.
REMOTE_PORT     - The remote port being used by user's
                  connection to the web server.
HTTP_USER_AGENT - The browser the client is using
                  to send the request.
HTTP_REFERER    - The url of the form that was filled out.
Seperate multiple entries with commas.
Example:<input type="hidden" name="env_report" value="REMOTE_ADDR,HTTP_USER_AGENT">

Field:sort
Description:This field allows you to choose the order in which you wish for your variables to appear in the results email that is sent. You can choose to have the field sorted alphabetically or specify a set order in which you want the fields to appear in the results email. By leaving this field out, the order will simply default to the order in which the browsers sends the information to the script (which is usually the same order as they appeared in the form.) When sorting by a set order of fields, you should separate field names with commas. Spaces and line breaks in the field will not affect the sort. This is helpful when you have many form fields and need to insert a line wrap.
Example:To sort alphabetically:

<input type="hidden" name="sort" value="alphabetic">

To sort by a set field order:

<input type="hidden" name="sort" value="first_name,last_name,etc...">


Field:print_config
Description:print_config allows you to specify which of the config variables (which are all of the fields listed on this page) you would like to have printed in the results email. By default, no config fields are printed in the results email. Separated multiple values with commas.
Example:<input type="hidden" name="print_config" value="email,subject">

Field:print_blank_fields
Description:print_blank_fields allows you to specify if form fields should be left out of the results email or not. PHP FormMail defaults to including blank fields, so use this to cause the results email to not include blank fields in the results email.
Example:If you want to NOT print any blank fields:
<input type="hidden" name="print_blank_fields" value="0">

If you want to print all blank fields (default behavior - this isn't really needed):
<input type="hidden" name="print_blank_fields" value="1">


Field:line_spacing
Description:line_spacing allows you to specify the number of empty lines between name value pairs in the results email. Defaults to 0 (zero).
Example: <input type="hidden" name="line_spacing" value="1">

Field:title
Description:This form field allows you to specify the title and header that will appear on the results page (unless you specify a redirect URL. Default value is:
Form Submission
Example:<input type="hidden" name="title" value="Feedback Form Results">

Field:return_link_url
Description:This field allows you to specify a URL that will appear, as return_link_title, on the following results page. This field will not be used if you have the redirect field set, but it is useful if you allow the user to receive the report on the following page, but want to offer them a way to get back to your main page.
Example:<input type="hidden" name="return_link_url" value="http://www.example.com/example.html">

Field:return_link_title
Description:This is the title that will be used to link the user back to the page you specify with return_link_url.
Example: <input type="hidden" name="return_link_title" value="Back to Main Page">

Field:missing_fields_redirect
Description:This form field allows you to specify a URL that users will be redirected to if there are fields listed in the required form field that are not filled in. This is so you can customize an error page instead of displaying the default.
Example:<input type="hidden" name="missing_fields_redirect" value="http://www.example.com/error.html">

Field:missing_fields_message
Description:This form field allows you to specify a customized message on the default error page.
Example:<input type="hidden" name="missing_fields_message" value="Please fill in all fields.">

Field:background
Description:This form field allow you to specify a background image that will appear if you do not have the redirect field set. This image will appear as the background to the form results page.
Example: <input type="hidden" name="background" value="http://www.example.com/image.gif">

Field:bgcolor
Description:This form field allow you to specify a bgcolor for the form results page in much the way you specify a background image. This field will be ignored if the redirect field is.
Example:<input type="hidden" name="bgcolor" value="#FFFFFF">

Field:text_color
Description:This field will change the color of the text on the results page.
Example:<input type="hidden" name="text_color" value="#000000">

Field:link_color
Description:This field will change the color of the links on the results page.
Example:<input type="hidden" name="link_color" value="#FF0000">

Field:vlink_color
Description:Changes the color of visited links on the results page.
Example:<input type="hidden" name="vlink_color" value="#0000FF">

Field:alink_color
Description:Changes the color of active links on the resulting page.
Example:<input type="hidden" name="alink_color" value="#0000FF">

Any other form fields that appear in your script will be mailed back to you.