---
schema_version: "1"
id: 360be55b640245770b189505ed7b07b2d3df3033a8be6c1c2d481c5d58ab36f2
title: BuildOptionList()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/references/content/mc-ampscript-reference-content-build-option-list.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-build-option-list.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: a4ccb1d3a8b1ad4f12a9183be471a4f548f59d38924fe665a8994c3ad2e26be2
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# BuildOptionList()

Creates a set of `<option>` tags that you can integrate into an HTML form on webpage.

## Availability

<table>
  <tr>
    <td>Marketing Cloud Engagement</td>
    <td>✅ Yes</td>
  </tr>
  <tr>
    <td>Marketing Cloud Next</td>
    <td>❌ No</td>
  </tr>
</table>

## Syntax

```
BuildOptionList(defaultSelection,
                option1Value, option1Text,
                [option2Value, option2Text] ... )
```

The `BuildOptionList()` function has three parameters:

- `defaultSelection` (string or number): Required. The option that is selected by default.
- `option1Value` (string): Required. An identifier for the first option. The function sets the `value` parameter in the `<option>` tag to this value.
- `option1Text` (string): Required. The display text for the option tag.

Each option in the list requires a value and a display text. You can create as many options as you need by appending them to the end of the function (`option2Value`, `option2Text`...).

## Usage

To use this function, specify a default selection, and a value and display name for each option that you want to generate.

This example creates a short list of options, and embeds it in an HTML form that asks the user to choose one:

```
%%[
set @DefaultOption = 2
set @OptionList = BuildOptionList(@DefaultOption,
                                  "1", "Option A",
                                  "2", "Option B",
                                  "3", "Option C")
]%%
<p>Choose an option:</p>
<select name="choice">
%%=v(@OptionList)=%%
</select>
```

The example outputs this HTML code.

```html
<p>Choose an option:</p>
<select name="choice">
  <option value="1">Option A</option>
  <option value="2" selected="selected">Option B</option>
  <option value="3">Option C</option>
</select>
```

In a web browser, the generated code resembles this example.

![A simple HTML form that contains a dropdown list. The text "Choose an option" is shown above the list. In the list itself, Option B is chosen by default.](https://developer.salesforce.com/docs/media/images/ampscript/mc-ampscript-reference-content-build-option-list.png)
