public function getStateName($countryID, $stateID) { $stateList = LocationUtilities::getStateList($countryID); foreach ($stateList as $state) { if ($state->getVariable(ReferenceObject::OBJECT_ID) == $stateID) { return $state->getVariable(ReferenceObject::OBJECT_NAME); } } return ""; }
<?php require_once "../config.php"; require_once $config->getIncludeURL(Config::INCLUDES_PATH, "utilities%location_utilities.php"); require_once $config->getIncludeURL(Config::INCLUDES_PATH, "objects%object.php"); require_once $config->getIncludeURL(Config::INCLUDES_PATH, "objects%reference_object.php"); if (isset($_GET['countryID']) && isset($_GET['locationType'])) { $countryID = $_GET['countryID']; $locationType = $_GET['locationType']; $stateList = LocationUtilities::getStateList($countryID); switch ($locationType) { //Search Location case 0: echo '<option value="0">Any State</option>'; break; //Profile Location //Profile Location case 1: echo '<option value="0">Not Telling!</option>'; break; } foreach ($stateList as $state) { echo '<option value="' . $state->getVariable(ReferenceObject::OBJECT_ID) . '">' . $state->getVariable(ReferenceObject::OBJECT_NAME) . '</option>'; } }