Title: Associative array in select?
Last modified: August 22, 2016

---

# Associative array in select?

 *  Resolved [emeyer_br](https://wordpress.org/support/users/emeyer_br/)
 * (@emeyer_br)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/associative-array-in-select/)
 * Is it possible to have an associative array? i.e.,
 * <option = “hammer”>Hammer</option>
    <option = “nail”>Nail</option>
 * [https://wordpress.org/plugins/admin-page-framework/](https://wordpress.org/plugins/admin-page-framework/)

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

 *  Plugin Author [miunosoft](https://wordpress.org/support/users/miunosoft/)
 * (@miunosoft)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/associative-array-in-select/#post-5191242)
 * Yes.
 * Pass an associative array to the `label` argument.
 *     ```
       array(	// Repeatable Drop-down List
       	'field_id'		=>	'select_repeatable',
       	'title'			=>	__( 'Repeatable Dropdown List', 'admin-page-framework-demo' ),
       	'type'			=>	'select',
       	'repeatable'	=>	true,
       	'description'	=>	__( 'To enable repeatable fields, set the <code>repeatable</code> key to true.', 'admin-page-framework-demo' ),
       	'default'		=>	'y',
       	'label'			=>	array(
       		'x'	=>	'X',
       		'y'	=>	'Y',
       		'z'	=>	'Z',
       	),
       ),
       ```
   
 *  Thread Starter [emeyer_br](https://wordpress.org/support/users/emeyer_br/)
 * (@emeyer_br)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/associative-array-in-select/#post-5191392)
 * Excellent, thanks for the help. I was able to get this working after I realized
   I wasn’t passing an associative array in my function.
 * I do have one more question, is it possible to do a conditional field based on
   another field setting?
 * I saw the “if” parameter, but how would I go about:
 * array(
    ‘field_id’=> ‘field1’, ‘type’ => ‘radio’, ‘title’ => ‘radiof’, ‘lable’
   => ‘array(‘1’=>’Yes’, ‘0’=>’No’)), array(‘field_id’ => ‘field2’, ‘type’ => ‘text’,‘
   title’ => ‘Name’, ‘if’ => \\If radio field equals 1 return true
 * thank you for this wonderful plugin, it has cut down on the amount of hours I
   would be creating a theme with.
 *  Plugin Author [miunosoft](https://wordpress.org/support/users/miunosoft/)
 * (@miunosoft)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/associative-array-in-select/#post-5191395)
 * Glad that the framework helped you. As for the new question, can you post a new
   topic about it? Thank you.

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

The topic ‘Associative array in select?’ is closed to new replies.

 * ![](https://ps.w.org/admin-page-framework/assets/icon-256x256.png?rev=998199)
 * [Admin Page Framework](https://wordpress.org/plugins/admin-page-framework/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/admin-page-framework/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/admin-page-framework/)
 * [Active Topics](https://wordpress.org/support/plugin/admin-page-framework/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/admin-page-framework/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/admin-page-framework/reviews/)

## Tags

 * [select](https://wordpress.org/support/topic-tag/select/)

 * 3 replies
 * 2 participants
 * Last reply from: [miunosoft](https://wordpress.org/support/users/miunosoft/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/associative-array-in-select/#post-5191395)
 * Status: resolved