Address Helper

Provides various helper functions when working with address in forms.

Summary
Address HelperProvides various helper functions when working with address in forms.
Functions
state_select()Creates a state/provience/county dropdown form input based on the entries in the address.states config.
country_select()Creates a country-based dropdown form input based on the entries in the address.countries config.

Functions

state_select()

if (!function_exists('state_select'))

Creates a state/provience/county dropdown form input based on the entries in the address.states config.  The word “state” is used but the structure can be used for Canadian proviences, Irish and UK counties and any other area based data.

Parameters

$selected_codeThe value of the item that should be selected when the dropdown is drawn.
$default_abbrThe value of the item that should be selected if no other matches are found.
$country_codeThe code of the country for which the states/priviences/counties are returned.  Defaults to ‘US’.
$select_nameThe name assigned to the select.  Defaults to ‘state_code’.

Return

A string with the full html for the select input.

country_select()

if (!function_exists('country_select'))

Creates a country-based dropdown form input based on the entries in the address.countries config.

Parameters

$selected_isoThe value of the item that should be selected when the dropdown is drawn.
$default_isoThe value of the item that should be selected if no other matches are found.
$select_nameThe name assigned to the select.  Defaults to ‘iso’.

Returns

A string with the full html for the select input.

if (!function_exists('state_select'))
Creates a state/provience/county dropdown form input based on the entries in the address.states config.
if (!function_exists('country_select'))
Creates a country-based dropdown form input based on the entries in the address.countries config.
Close