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
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘State Value and label’ is closed to new replies.