Documentation

SimpleContactForm.php >> << SecurityImage.php

SimpleContactForm.configuration.php

This configuration file controls the behaviour of the SimpleContactForm script.
This file contains settings that affect all forms but certain settings in this file may be overwritten on a per form basis.

Option Type Description
phpMailerRoot String / Path Defines the relative path from the base HTML file to PHPMailer. By default this points to the PHPMailer library included with this script but may be changed if you use your own copy.
This settings is global and has no effect in individual form configuration files.
useExternalFiles Boolean If true the CSS and Javascript files needed for this script will not automatically be loaded.
Use this setting if you would prefer to include this script's CSS and Javascript in your own files.
This settings is global and has no effect in individual form configuration files.
website String This settings is not needed but provides a single location to change the website name used throughtout this script.
useTextCaptcha Boolean If true a very simple verification question will be used instead of an image.
If your server does not support th PHP GD image library then this setting will be ignored.
useSmtpServer Boolean If true the script will attempt to connect to an SMTP server to send the email when a form is submitted. If this setting is on then smtpServer, smtpUsername, smtpPassword and smtpPort must specify an existing SMTP server.
smtpAuth Boolean Does the SMTP server require authentication?
smtpServer String The name of the SMTP server to use.
This setting is ignored if useSmtpServer is false.
smtpUsername String The username used to connect to the SMTP server.
This setting is ignored if useSmtpServer is false.
smtpPassword String The password used to connect to the SMTP server.
This setting is ignored if useSmtpServer is false.
smtpPort Integer The port used to connect to the SMTP server.
This setting is ignored if useSmtpServer is false.
smtpDebug Integer 0 = No debugging.
1 = Errors and messages.
2 = Messages only.
from Array[Email, Name] The email address used in the from field of all emails sent from a form. Each email constists of a pair of value, first the email address and then a matching name.
to Array[Email, Name, ...] A list of email addresses that a submitted for will be sent to. This list may contain a single email, or multiple emails. Each email constists of a pair of value, first the email address and then a matching name.
subject String The value of the subject field of any email sent from a form.

Fields

The configuration file also requires a fields property. This property contains a list of all fields used by the forms as well as data describing how to validate each field.
The fields defined in this file are used by all forms by default. If a website requires multiple forms with different fields a per form configuration must be created which provides its own field data.

The fields property is an array with a single entry for each field in the form. All available field options are described below.
For more information on how to edit the field data see Configuring the fields.

Option Description
allowHTML Normally all HTML code will be escaped when the form is submitted. Add this rule to allow a field to contain HTML.
alphanum The field may only contain letters and number. A field containing any other characters will be considered invalid.
checked This field must be ticked. (Used for checkboxes such as Licence agreements etc.)
email This field must contain a valid email. This only checks that the given value is in the correct form and does not check if the email actually exists.
integer This field may only contain numbers. A field containing any other characters will be considered invalid.
maxLength This field may not contaiin more than maxLength characters. This field requires a single parameter to determine the maximum length, eg. maxLength=10.
minLength This field may not contaiin less than maxLength characters. This field requires a single parameter to determine the minimum length, eg. minLength=10.
recipient This option allows a copy of the submitted for to also be sent to the email specified in the field marked with this option.
required This field must exist and may not be empty.
select Used by radio groups, checkboxes and comboboxes. This option specifies that at least on value must be selected. This option may take an optional parameter specifying the default selection. The selection specified by this parameter will not be considered as a valid selection.
url This field must contain a valid URL. This only checks that the given value is in the correct form and does not check if the URL actually exists.
verification This field's value must match the captcha verification code. This code is automatically generated when the captcha is shown and stored in a session variable.

Strings

The string setting contains a list of all messages displayed to the user. It provides a single place to easily change all text message used by this script.

String Description
success Displayed at the top of a form when an email was successfully sent.
fail Displayed at the top of a form when an email failed to send for some reason.
invalid Displayed at the top of a form when one or more fields were not invalid.
refresh The text displayed in the link which allows a new captcha image to be generated.
question The text used by the text based captcha question.
v_alphanum Displayed when a field fails the alphanum validation.
v_checked Displayed when a field fails the checked validation.
v_email Displayed when a field fails the email validation.
v_integer Displayed when a field fails the integer validation.
v_maxLength Displayed when a field fails the maxLength validation.
v_minLength Displayed when a field fails the minLength validation.
v_select Displayed when a field fails the select validation.
v_required Displayed when a field fails the required validation.
v_url Displayed when a field fails the url validation.
v_verification Displayed when a field fails the verification validation.

SimpleContactForm.php >> << SecurityImage.php