Hey there, php is not my strong point. I can't write my own php to save my life, but if I have a snippet I can usually figure out how to tweak it.
I have a form which autopopulates a few form fields when the user enters his/her zip code, the city and state fields are populated from a mysql db. The state field is an abbreviated version of the state. I need to create a new value from the state value using php. So if the state is AL, I need to be able to have a new value "Alabama", if the state is CA, I need a new value for "california", etc. Does anyone know how I can do this? I need both values, so it isn't that I would need to rename the value. Thanks.
Create New Form Value
Moderator: General Moderators
Re: Create New Form Value
You can use Associative array in order to achieve this
Here we can use the values as keys and assign values to them.The ID keys can be used in a script:
Code: Select all
$state = array("AL"=>"Alabama","CA"=>"california");
Code: Select all
$state['AL'] = "Alabama";
$state['CA'] = "california";