When users submit your form, you have the option to send them to a custom confirmation page via the Form Settings’ redirect URL option. In order to pass data from the form to the confirmation page, Cognito Forms supports parameterized redirect URLs.
To start using this feature, first you will need a URL that is going to be receiving the information from the form. This URL will be called the ‘base URL’ and should include the protocol, server name, and resource id.
To add parameters, at the end of the base URL, you will need to add a question mark (?) after the last character of the base URL.
Each parameter contains two parts, a Key and a Token that is separated by an equal sign (=). The Key will be used to assign the field value outside of the form. The Key can be named anything that fits your needs. The Token must be named the same your field’s label in your form and must be contained inside brackets [ ].
As an example, if you have a name field on your form labeled “Name”, the parameter will look like this:
Please notice in this example, Name is being used for both the Key and the Token. Although this is helpful, you do not need to have the Key named the same as the Token. The following is also acceptable as long as the Key matches your value outside of the form:
Your redirect URL would like this:
Additional parameters can be added by separating each parameter using an Ampersand (&). Adding an Address to the example above would look like this, if your field’s label is ‘Address’ on your form:
For questions within a Rating Scale or fields within a Section, you will need to be more specific with your Token values. First you should include the label of the Rating Scale or Section followed by a period (.), and then add the Label of the field.
An example, for a Rating Scale question labeled Question1, the parameter would be:
The URL example from before will now look like:
The fields that can be used as parameters within a Redirect URL are: Name, Textbox, Address, Choice, Date/Time, Email, Number, Website, Currency, Rating Scale, Section, and Calculation.
The following fields cannot be used as parameters: Content, Repeating Section, and File Upload.
There is no limit to the number of fields that can be used as redirect URL parameters; however, most modern browsers only allow for URLs to be 2000 characters in length.
If the field you are using has multiple areas to enter text you can target only one text area of a field by using the same method used in Section and Rating Scale. To target only the First Name of a Name field use Name=[Name.First] and to target the Last Name use Name=[Name.Last]. For example if you only want to collect the First Name and not the Last Name.
This can also be used for the Address Field. The different Tokens for the Address are; Line1, Line2, City, State, PostalCode. An example would be to only collect the first line of an address field.
The form ID is not a field on the form but you can capture and display the ID through a redirect URL so that users will have a reference number. The token for a form id is simply [Id].
Once you’ve passed the data through the URL, you can use a PHP $_GET function to capture the data and include it on your custom confirmation page. For example:
Thank you for your submission, [First.Name]!