I am using ampscript in Cloud Pages. I am creating a form that will have a different number of options based on DE data. I need to change DE data based on the information that comes out of the form. I intend to put the data into the post array, but I don't know how to pull it out. I know how to put information into the post array with CloudPagesURL(), and I can get information out of the post array when I know what to ask for with requestparameter().

Is there a way to find the length of the array, or find the keys in the array?


The values of the various form elements' name attributes will be available to RequestParameter() after form submission.

For example, if your form looks like this...

<form method="POST" action="https://my-other-landing-page">
  <input type="text" name="firstName">
  <input type="text" name="lastName">

  <select name="state">
    <option value="ca">California</option>
    <option value="ny">New York</option>

  <input type="radio" name="optin" value="yes"> Yes
  <input type="radio" name="optin" value="no" checked> No


The AMPscript on "my-other-landing-page" would look something like this...

var @firstName,

set @firstName = RequestParameter('firstName')
set @lastName = RequestParameter('lastName')
set @state = RequestParameter('state')
set @optin = RequestParameter('optin')

/* the rest of your logic... */
| improve this answer | |
  • I agree with this being the generally accepted method, but here OP specifically provides the point of not being able to use RequestParameter, as the names and number of fields are not known – Lukas Lunow Apr 18 '19 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.