Title: Trying to add Multiple Drop Down Boxes
Last modified: August 21, 2016

---

# Trying to add Multiple Drop Down Boxes

 *  [liongrass](https://wordpress.org/support/users/liongrass/)
 * (@liongrass)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/trying-to-add-mutliple-drop-down-boxes/)
 * Hi,
    first of all, thank you very much for this helpful plugin, much appreciated!
 * Now, what i am trying to do, is modyfing your plugin in a way, that it adds another
   profile field type, which allows for multiple drop down boxes.
 * I accomplished adding such a profile field type (it contains two drop down boxes)
   and it nicely shows up in the admin area and the user edit page.
 * But now this is where i’m stuck for several days now (i’m a beginner at php),
   i don’t know how to save both values from the drop down boxes into the database.
   It only will save and display the value of the last one. I guess i have to give
   each box a unique id or something, so they won’t override each other.
 * The datepicker field seems to do something similar, as it has three drop down
   boxes and each box has an own id
    but i wasn’t able to figure out how it saves
   and displays the values. Do you have any idea, how i could accomplish that?
 * [http://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/](http://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [donmik](https://wordpress.org/support/users/atallos/)
 * (@atallos)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/trying-to-add-mutliple-drop-down-boxes/#post-4211922)
 * Hi,
 * You cannot take the datebox field as an example because datebox is a type from
   buddypress, it has custom code to save its values.
 * You can check the function to save profile data in bp-xprofile/bp-xprofile-screens.
   php:
    xprofile_screen_edit_profile. Here, buddypress saves the value of fields:
 *     ```
       if ( !xprofile_set_field_data( $field_id, bp_displayed_user_id(), $value, $is_required[$field_id] ) ) {
          $errors = true;
       } else {
          do_action( 'xprofile_profile_field_data_updated', $field_id, $value );
       }
       ```
   
 * The only way to make your idea work is maybe concat values and saving all values
   with the same field_id.
 * The problem is there is no hook you can use when editing profile, so I don’t 
   think you can do it but maybe I’m wrong.
 * I believe, a few weeks ago, someone ask me if there is a way to do this or something
   simliar and I answer the best way will be doing with javascript. Make only one
   field input text with Xprofile. Then write some javascript to hide this field
   and create the dropdown boxes you need, when the user select options in dropdown
   boxes, get it with javascript and write it on the hidden input field. Then buddypress
   will save it right in the database.
 *  [twopheat](https://wordpress.org/support/users/twopheat/)
 * (@twopheat)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/trying-to-add-mutliple-drop-down-boxes/#post-4212011)
 * Could the date field be decoded and tweaked to two fields, 3-7 and 1-12? ie for
   Feet’Inches”
 *  [twopheat](https://wordpress.org/support/users/twopheat/)
 * (@twopheat)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/trying-to-add-mutliple-drop-down-boxes/#post-4212013)
 * 1. Create a dummy form field to get the format
    Create a profile filed called
   Country as a dropdown select box. Add a few options to the list e.g. Enter Your
   Country (this will be the default), Afghanistan, Aland Islands Save and close
   the profile form editor 2. Export the field data to Excel Login to PHPMyAdmin(
   you may need to login to CPanel first if you have a hosted website) Go to the
   database and table containing the form data (e.g. wrdp1>wp_bp_xprofile_fields)
   Export the table to Excel CSV format. Check to include the field labels in the
   header. 3. Modify the data in Excel. Opening the data in Excel will give you 
   a feel for the layout of the data. Not the ID number for the options you have
   entered above. Copy and paste you list of countries (search on google for a list
   in excel or CSV format). Then make the data conform EXACTLY to the sample data
   you entered – making sure that the record ID numbers start from same ID number
   as your sample (you can delete the sample countries to avoid duplicates). Also
   ensure the Parent ID is the same as a field record. Save the data as a CSV file
   4. Import into the table Go back to the table you exported in PHPMyAdmin Import
   the CSV file you just modified. Check to replace the table contents. Ignore the
   first line of data if you have kept the field labels at the top of your file.
   Check that the record delimiter is a comma. Now click GO and your data will be
   imported – Click Browse to check it. 5. Check your profile form Go back to the
   profile form editor – your new country field should now be populated by the countries
   you imported.
 * This also works for any other dropdown list.
 * pewit – [https://buddypress.org/support/topic/how-to-make-a-country-drop-down-list-in-profile-field/](https://buddypress.org/support/topic/how-to-make-a-country-drop-down-list-in-profile-field/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Trying to add Multiple Drop Down Boxes’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/buddypress-xprofile-custom-fields-
   type.svg)
 * [Buddypress Xprofile Custom Fields Type](https://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/buddypress-xprofile-custom-fields-type/)
 * [Active Topics](https://wordpress.org/support/plugin/buddypress-xprofile-custom-fields-type/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/buddypress-xprofile-custom-fields-type/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/buddypress-xprofile-custom-fields-type/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [twopheat](https://wordpress.org/support/users/twopheat/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/trying-to-add-mutliple-drop-down-boxes/#post-4212013)
 * Status: not resolved