Title: State Value and label
Last modified: August 30, 2016

---

# State Value and label

 *  Resolved [ahyatemat](https://wordpress.org/support/users/ahyatemat/)
 * (@ahyatemat)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/state-value-and-label/)
 * Hi,
 * I’m trying to register the states values from the registration page to woocommerce
   account.
 * Here’s the code:
 *     ```
       <p class="form-row form-row form-row-first address-field validate-required validate-state" id="billing_state_field">
       		<label for="billing_state"<?php $template->the_instance(); ?>"><?php _e( 'State / County', 'theme-my-login' ); ?> <abbr class="required" title="required">(required)</abbr></label>
       <select name="billing_state<?php $template->the_instance(); ?>" id="billing_state" class="country_to_state country_select " tabindex="-1" title="Country *" style="">
       <?php
       $states = array(
       '' => __('Select an option…', 'woocommerce') ,
       JHR => 'Johor' ,
           KDH => 'Kedah' ,
           KTN => 'Kelantan' ,
           MLK => 'Melaka' ,
           NSN => 'Negeri Sembilan' ,
           PHG => 'Pahang' ,
           PRK => 'Perak' ,
           PLS => 'Perlis' ,
           PNG => 'Pulau Pinang' ,
           SBH => 'Sabah' ,
           SWK => 'Sarawak' ,
           SGR => 'Selangor' ,
           TRG => 'Terengganu' ,
           KUL => 'W.P. Kuala Lumpur' ,
           LBN => 'W.P. Labuan' ,
           PJY => 'W.P. Putrajaya' ,
         );
         foreach ($states as $value => $label): ?>
       <option value="<?php echo $value; ?>" <?php $template->the_posted_value( 'billing_state' ); ?>"><?php echo $label; ?></option>';
       <?php endforeach ?>
       </select>
       ```
   
 * So it should appear the full state name ($label) but instead it just showed the
   $value name in my account page.
 * I would like to pass the value with the full state name.
 * Please, someone would have a solution?
 * Thank you
 * [https://wordpress.org/plugins/theme-my-login/](https://wordpress.org/plugins/theme-my-login/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Jeff Farthing](https://wordpress.org/support/users/jfarthing84/)
 * (@jfarthing84)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/state-value-and-label/#post-6791450)
 * Put your array into a function which will be used to lookup the code and then
   use that function to display it on the account page.

Viewing 1 replies (of 1 total)

The topic ‘State Value and label’ is closed to new replies.

 * ![](https://ps.w.org/theme-my-login/assets/icon-256x256.png?rev=1891232)
 * [Theme My Login](https://wordpress.org/plugins/theme-my-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/theme-my-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/theme-my-login/)
 * [Active Topics](https://wordpress.org/support/plugin/theme-my-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/theme-my-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/theme-my-login/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Jeff Farthing](https://wordpress.org/support/users/jfarthing84/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/state-value-and-label/#post-6791450)
 * Status: resolved