Master Form PHP V3
 
 

[home]

User Manual

General   Control Panel   Form Features
   
 

Email Placeholders

Index

The outgoing email specified in the control panel (see the "Create Table Setup" section of the User Manual) may contain placeholders to:

  1. List all information submitted with the form.

  2. Printed any information submitted with the form, whichever form fields you want printed in the email.

  3. Conditionally print certain form information. The condition is whether or not the form field (or any other form field) contains information.

  4. Print answers to arithmetic using the values of form fields with the [[MATH...]] placeholder.

Placeholders are keys or commands between double square brackets. They are case-sensitive. Example: [[email]]

Placeholders may be used in the email body, the subject, the from fields, and any of the destination fields.

List All Form Information

To print a list of the values of all form fields, use this placeholder (case-sensitive):

[[ALL_FIELDS]]

The user's IP address is included in the list.

If any files are uploaded with the form, the uploaded file names are included in the list.

Print Any Form Information

To selectively print form information, use a placeholder with the form field information.

Example: [[email]]
(To print the email address provided with the form.)

Example of use.

Your email address of record is [[email]]. 
If [[email]] is not correct, use the 
"My Record" menu item in the membership area 
to update your information.

One, some, or all form fields may be printed in the places you want them by using placeholders.

[[IP]] is a special placeholder that prints the IP address of the form user. It is available unless the form has a field name="IP".

Form field names, like all placeholder keys/commands, are case-sensitive.

Conditionally Print Form Information

Form information can be printed conditionally using one of these two sets of placeholders.

[[if_FIELDNAME]] content [[/if_FIELDNAME]]
[[ifnot_FIELDNAME]] content [[/ifnot_FIELDNAME]]

Replace FIELDNAME with the field name that is the condition. All is case-sensitive.

When the "if_" placeholder set is used, the content between the placeholders will be printed if the field named in the placeholder contains information.

When the "ifnot_" placeholder set is used, the content between the placeholders will be printed if the field named in the placeholder does not contain information.

Examples:

The following examples assume:

To print the label text with the first name and last name only if they were provided with the form:

[[if_firstname]]First name: [[firstname]][[/if_firstname]]
[[if_lastname]]Last name: [[lastname]][[/if_lastname]]

Because name="firstname" contains no information, only the last line will be printed in the email.

Last name: Bontrager

To give away a prize to people who provided their first name, something like this can be used:

[[if_firstname]]Your prize is the sent to [[email]] address.[[/if_firstname]]
[[ifnot_firstname]]We're sorry, you did not win.[[/ifnot_firstname]]

Because name="firstname" contains no information, the "ifnot_" placeholder set prevails.

We're sorry, you did not win.

Now, let's do the same condition test with the name="lastname" field.

[[if_lastname]]Your prize is the sent to [[email]] address.[[/if_lastname]]
[[ifnot_lastname]]We're sorry, you did not win.[[/ifnot_lastname]]

Because name="lastname" does contain information, the "if_" placeholder set prevails.

Your prize is sent to the name@example.com address.

Any placeholders can be used as content between the "if_" and "ifnot_" placeholder sets except other "if_" and "ifnot_" placeholder sets.

The [[MATH...]] Placeholder

The [[MATH...]] placeholder is used to print the solution to addition, subtraction, multiplication, division, and remainder arithmetic problems. It prints arithmetic solutions using the values of form fields in the calculations.

The [[MATH...]] placeholder is used to do counting and arithmetic operations on form field values.

Form field placeholders are used to insert form field values into the [[MATH...]] placeholder. The [[MATH...]] placeholder is then replaced with the calculated value.

[[MATH operations]]

operations would normally include one or more form field placeholders that have numbers for values.

Here are two example placeholders, one with an addition operating and the other a division:

[[MATH [[Item1]] + [[Item2]] ]]
[[MATH [[Item1]] / [[Item2]] ]]

Assuming form field name="Item1" has a value of 33 and field name="Item2" has a value of 7, then those two placeholders will be replaced with:

40
4.71428571428571

Division accuracy is limited by what your installation of PHP and your Internet server software can utilize when doing calculations.

The calculated result can be rounded to a certain number of decimal places.

To accomplish that, append a digit to the placeholder's MATH keyword. The digit can be any from 0 through 9. (Rounding is to the nearest number. For two decimal places 1.001 would be rounded to 1.00 and 1.005 would be rounded to 1.01)

Here are the same examples except instructing the results be rounded to 2 decimal places:

[[MATH2 [[Item1]] + [[Item2]] ]]
[[MATH2 [[Item1]] / [[Item2]] ]]

Assuming the field names have the same values as before, those placeholders would be replaced with:

40
4.71

The software can be instructed to append 0's to force the result to have the same number of decimal places as the rounding specified.

To accomplish that, append a 0 (zero) to the rounding digit.

Here are the same examples except with 0's to force the result to have the number of decimal places as specified with the rounding digit:

[[MATH20 [[Item1]] + [[Item2]] ]]
[[MATH20 [[Item1]] / [[Item2]] ]]

Assuming the field names have the same values as before, those placeholders would be replaced with:

40.00
4.71

The MATH0 keyword is used to round to the nearest whole number.

[[MATH0 [[Item1]] + [[Item2]] ]]
[[MATH0 [[Item1]] / [[Item2]] ]]

Assuming the field names have the same values as before, those placeholders would be replaced with:

40
5

Rounding accuracy is limited by the number of decimal places your installation of PHP and your Internet server software can utilize when doing calculations.

The following mathematical symbols may be used in the [[MATH...]] placeholder:

Symbol Operation
+ addition
- subtraction
* multiplication
x multiplication
X multiplication
/ division
% remainder
r remainder
R remainder

The operations part of the [[MATH...]] placeholder may include parenthesis to force calculation of certain parts of the equation before other parts. The part between the parenthesis will be calculated first.

Here are two examples:

[[MATH ( [[Item1]] / [[Item2]] ) + [[Item2]] ]]
[[MATH [[Item1]] / ( [[Item2]] + [[Item2]] ) ]]

Assuming form field name="Item1" has a value of 33 and field name="Item2" has a value of 7, then those two placeholders will be replaced with:

11.7142857142857
2.35714285714286

In the first placeholder, 33 is divided by 7, then 7 is added. In the second placeholder 7 is added to 7, resulting in 14, then 33 is divided by 14 .

Numbers can be included in the operation in addition to or instead of form field names. Here are several examples:

[[MATH ( ([[Item1]]/[[Item2]]) + [[Item2]] ) - 9 ]]
[[MATH 44 / (2 + 4) ]]
[[MATH [[Item1]] * [[Item2]] ]]
[[MATH [[Item1]] / [[Item2]] ]]
[[MATH [[Item1]] % [[Item2]] ]]

Assuming the values of the form fields are as before, the above placeholders would be replaced with:

2.71428571428572
7.33333333333333
231
4.71428571428571
5

The [[COUNT...]] placeholder may be used in the operations part of the [[MATH...]] placeholder to determine the number of form fields that have check marks or otherwise contain information.

Here is the format of the [[COUNT...]] placeholder.

[[COUNT Item1, Item2, Item8]]

The words following COUNT is a comma-separated list of applicable form field names.

Put the entire [[COUNT...]] placeholder into the [[MATH...]] placeholder, including its double square brackets.

As an example of use, let's suppose you sold certain types of documents at $1.25 each. Your order form lists the documents next to checkboxes customers can check to buy. The form field names of the checkboxes are name="documents[]".

This example shows one way to present the total amount of the order, including an order tax of 6.5%.

(The [[MATH...]] placeholder may span multiple lines.)

Number of documents: [[COUNT documents]]

  Cost of documents: [[MATH20 [[COUNT documents]] * 1.25]]

   Tax on documents: [[MATH20 
                       ([[COUNT documents]] * 1.25) 
                       * 0.065]]

         Total cost: [[MATH20 
                      (
                       ([[COUNT documents]] * 1.25) 
                       * 0.065
                      ) + 
                       [[COUNT documents]] * 1.25]]

For similar functions to customize the confirmation/thank-you page, see the Confirmation/Thank-you Page User Manual section.

[user manual]
[home]

Master Form PHP V3, version 3.0
Copyright 2010, 2011 Bontrager Connection, LLC
Copyright 2011-2013, 2015, 2017, 2020 Will Bontrager Software LLC