RequestParameter

This function is similar to QueryParameter, but in addition to retrieving a value from a URL query string, it can also be used to retrieve form field values.

NOTE: You can use this function to retrieve parameter values from URLs in encrypted query strings created by the CloudPagesURL or MicrositeURL functions.

Argument

RequestParameter(1)

Ordinal Type Required Description
1 String True URL parameter key or field name attribute

Example

The following code is used on a landing page for a registration form. When the user completes the form, the InsertData function creates a new Data Extension record from the form field values.

%%[

if RequestParameter("submitted") == true then

  InsertData(
        "Registrations",
        "FirstName", RequestParameter("firstname"),
        "LastName", RequestParameter("lastname"),
        "Company", RequestParameter("company"),
        "Email", RequestParameter("email")
       )

endif

]%%

<!DOCTYPE html>
<html>
   <body>
      %%[ if RequestParameter("submitted") == true then ]%%
         <p>Thank you for submitting your details.</p>
      %%[ else ]%%
      <h2>Register</h2>
      <form action="%%=RequestParameter('PAGEURL')=%%" method="post">
         <label>First name</label>
         <input type="text" name="firstname">
         <label>Last name</label>
         <input type="text" name="lastname">
         <label>Company</label>
         <input type="text" name="company">
         <label>Email</label>
         <input type="text" name="email">
         <input name="submitted" type="hidden" value="true" />
         <input type="submit" value="Submit">
      </form>
      %%[ endif ]%%
   </body>
</html>

Output

When the form is submitted, a Data Extension record will be created with the form field values and the following text will be displayed on the page.

<p>Thank you for submitting your details.</p>