<option value=””>

Attribute of
<option> HTML Tag
What does <option value=""> do?
Defines the data sent to the server when a form option item is selected.

Code Example

<p><strong>Select your favorite species of flamingo.</strong></p>

<select name="favorites">
          <option value="American">American flamingo</option>
          <option value="Greater">Greater flamingo</option>
          <option value="Lesser">Lesser flamingo</option>
          <option selected value="Andean">Andean flamingo</option>
          <option value="Chilean">Chilean flamingo</option>
          <option value="James's">James's flamingo</option>

Select your favorite species of flamingo.

Sending Option Data in Forms

When you define a form, you’ll use the <option> element to create the various selectable options. The text you write between <option> and </option> is the text the visitor will see.

The content of the value attribute for the <option> is sent as the response to the form, so this is what will be sent to the email recipient, or submitted to the database.

The user has no visibility of its value, and just sees the text between <option> and </option>.

What Happens If There’s No Value?

If you don’t specify a value for the option, the text between <option> and </option> will be submitted instead.

In some cases – such as email forms – this might be valid behavior. However, this could result in lengthy form data that doesn’t play well with database fields, or conform to maximum length restrictions.

It’s good practice to specify the value, in any case.

Browser Support for value