### [How to Store Field Values in the WPForms Entry](https://wpforms.com/developers/how-to-store-field-values-in-the-wpforms-entry/)

**Published:** December 16, 2022
**Author:** Umair Majeed

**Excerpt:** This tutorial will show you how to use PHP to take the field value and store it on the entry rather than the field label. 

**Content:**

Would you like to store field values for the **Dropdown**, **Checkboxes**, and **Multiple Choice** fields inside the WPForms entry? In this tutorial, we’ll show you how to use PHP to take the field value instead of the field label and store it inside the entry.

## Storing the value inside the entry

For this tutorial, we’re going to actually add the snippets to our site first before creating the form. We do this simply because part of this snippet is to enable the option on the fields for **Show Values** for the **Dropdown**, **Checkboxes**, and **Multiple Choice** fields.

For assistance with how and where to add snippets, [please check out this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

We’ve added two separate snippets. The first snippet is following [this tutorial](https://wpforms.com/developers/add-field-values-for-dropdown-checkboxes-and-multiple-choice-fields/ "How to Add Field Values for Dropdown, Checkboxes, and Multiple Choice Fields") that will allow us to add field values for the **Dropdown**, **Checkboxes**, and **Multiple Choice** fields.

The second snippet takes the form submission and while processing it will grab the field value instead of the field label to store on the entry.

**Important:** If you’re using **conditional logic in notifications** that relies on the **Dropdown field**, this snippet may cause those rules to stop working.

This is because notification conditions compare the **choice label**, while this snippet stores and uses the **choice value** instead. Since labels and values are different, they won’t match and the condition will not be triggered.

## Creating the form

Now it’s time to create your form and add your fields which will include at least one **Dropdown**, **Checkboxes**, or **Multiple Choice**.

If you need any help in creating forms, [please review our detailed documentation](https://wpforms.com/docs/creating-first-form/ "Creating Your First Form").

![begin by creating your form and adding your fields](https://wpforms.com/wp-content/uploads/2022/12/wpforms-field-value-entry-create-form.jpg)For the purpose of this documentation, we added a **Dropdown** field for the contact preference. In order to add the field values, just select the field and click the **Advanced** tab.

![click the button to turn on the Show Values](https://wpforms.com/wp-content/uploads/2022/12/wpforms-enable-show-value.jpg)Click the button to toggle on the **Show Values** and then you click back to the **General** tab to add your field values.

![add in the values you want on your field](https://wpforms.com/wp-content/uploads/2022/12/wpforms-add-field-values.jpg)Once you’ve saved the form, you can now see that the field values are stored inside the form entry rather than the field label.

![using this snippet you can store the field values on the entry](https://wpforms.com/wp-content/uploads/2022/12/wpforms-store-values-entry.jpg)Would you like to also send the field values through using the **Zapier** addon? Take a look at our tutorial on [How to Send Field Values to Excel Using Zapier](https://wpforms.com/developers/how-to-send-field-values-to-excel-using-zapier/ "How to Send Field Values to Excel Using Zapier").

## Reference Filter

[wpforms\_process\_filter](https://wpforms.com/developers/wpforms_process_filter/ "Using the wpforms_process_filter")

## FAQ

#### Q: How can I target just a single form?

**A:** To target only 1 form, just use this snippet instead. You’ll need to update the **584** to match your own form ID. To find your form ID, [please review this tutorial for assistance](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/**
 * Show values in Dropdown, checkboxes, and Multiple Choice.
 *
 * @link https://wpforms.com/developers/add-field-values-for-dropdown-checkboxes-and-multiple-choice-fields/
 */
   
add_action( 'wpforms_fields_show_options_setting', '__return_true' );

/**
 * Save choices 'values' instead of 'labels' for the fields with 'Show values' option enabled.
 *
 * @link https://wpforms.com/developers/how-to-store-field-values-in-the-wpforms-entry/
 */
function wpf_dev_process_filter_choices_values( $fields, $entry, $form_data ) {
	
	// Optional, you can limit to specific forms. Below, we restrict output to
    // form #584.
    if ( absint( $form_data[ 'id' ] ) !== 584 ) {
        return $fields;
    }
 
    if ( ! is_array( $fields ) ) {
        return $fields;
    }
 
    foreach ( $fields as $field_id => $field ) {
        if (
            isset( $field[ 'type' ] ) &&
            in_array( $field[ 'type' ], [ 'checkbox', 'radio', 'select' ], true ) &&
            ! empty( $form_data[ 'fields' ][ $field_id ][ 'show_values' ] )
        ) {
            $value_raw = ! empty( $field[ 'value_raw' ] ) ? $field[ 'value_raw' ] : '';
            $field[ 'value_raw' ] = $field[ 'value' ];
            $field[ 'value' ] = $value_raw;
            $fields[ $field_id ] = $field;
        }
    }
 
    return $fields;
};
add_filter( 'wpforms_process_filter', 'wpf_dev_process_filter_choices_values', 10, 3 );
```

**Categories:** Entries

**Tags:** PHP

---

