Title: Dropdown dynamically generated
Last modified: April 6, 2020

---

# Dropdown dynamically generated

 *  [martyn](https://wordpress.org/support/users/marty2010/)
 * (@marty2010)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/dropdown-dynamically-generated/)
 * Hi there,
    Im using yor plugin with satisfaction, but I have a question for you.
   I need to have a dropdown dynamically generated from a text box field in a registration
   form. Ref: Luogo (city) field Example a new user inserts its city in the registration
   form and that data is taken automatically in the search dropdown field. Registration
   field > New York > ok, New York now is automatically in the homepage dropdown
   search field. I’m asking for your help because cannot write an endless list of
   cities using a multi select registration field. I hope there is a solution from
   your plugin. Thank you
    -  This topic was modified 6 years, 1 month ago by [Yui](https://wordpress.org/support/users/fierevere/).
    -  This topic was modified 6 years, 1 month ago by [Yui](https://wordpress.org/support/users/fierevere/).
      Reason: extra link deleted
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdropdown-dynamically-generated%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [martyn](https://wordpress.org/support/users/marty2010/)
 * (@marty2010)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/dropdown-dynamically-generated/#post-12637741)
 * Populating a drop down list from specific Ultimate Member registration form field
   or profile form field (meta key, id).
    Is my intuition right?
 *     ```
       function field_choices( $field ) {  
   
           $field['luogo'] = array();   
   
           $choices = get_field('my_select_values', 'option', false);
   
           $choices = explode("\n", $choices);   
   
           $choices = array_map('trim', $choices);
   
           if( is_array($choices) ) {      
               foreach( $choices as $choice ) {           
                   $field['luogo'][ $choice ] = $choice;           
               }       
           }   
           // return the field
           return $field;    
       }
       add_action('um_get_members', 'field_choices');
       ```
   
    -  This reply was modified 6 years, 1 month ago by [martyn](https://wordpress.org/support/users/marty2010/).
    -  This reply was modified 6 years, 1 month ago by [martyn](https://wordpress.org/support/users/marty2010/).

Viewing 1 replies (of 1 total)

The topic ‘Dropdown dynamically generated’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

## Tags

 * [dropdown](https://wordpress.org/support/topic-tag/dropdown/)
 * [dropdown menu](https://wordpress.org/support/topic-tag/dropdown-menu/)
 * [metakey](https://wordpress.org/support/topic-tag/metakey/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 1 reply
 * 1 participant
 * Last reply from: [martyn](https://wordpress.org/support/users/marty2010/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/dropdown-dynamically-generated/#post-12637741)
 * Status: not resolved