I would like to know how to change this php code to a drop down list for country, state and city?
<pre><code>&lt;?php
class Misc extends CI_Model {

     function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }


    function time_nice($time = '')
    {
        $time_now = time();
        $difference = $time_now - $time;
        if ($difference &lt; 3600)
        {
            //return minutes
            return vlang('dashboard_minutes_ago', floor($difference / 60));        
        }
        elseif ($difference &lt; 86400)
        {
            //return hours
            //return floor($difference / 3600).' hours ago';
            return vlang('dashboard_hours_ago', floor($difference / 3600));    
        }
        else
        {
            //return days
            //return floor($difference / 86400).' days ago';
            return vlang('dashboard_days_ago', floor($difference / 86400));    
        }
    }

    function states_list()
    {
        $state_list = array(
                ''=&gt;'',
                'AB'=&gt;"Alberta", 
                'AL'=&gt;"Alabama",
                'AK'=&gt;"Alaska", 
                'AZ'=&gt;"Arizona", 
                'AR'=&gt;"Arkansas", 
                'BC'=&gt;"British Columbia", 
                'CA'=&gt;"California", 
                'CO'=&gt;"Colorado", 
                'CT'=&gt;"Connecticut", 
                'DE'=&gt;"Delaware", 
                'DC'=&gt;"District Of Columbia", 
                'FL'=&gt;"Florida", 
                'GA'=&gt;"Georgia", 
                'HI'=&gt;"Hawaii", 
                'ID'=&gt;"Idaho", 
                'IL'=&gt;"Illinois", 
                'IN'=&gt;"Indiana", 
                'IA'=&gt;"Iowa", 
                'KS'=&gt;"Kansas", 
                'KY'=&gt;"Kentucky", 
                'LA'=&gt;"Louisiana", 
                'ME'=&gt;"Maine", 
                'MD'=&gt;"Maryland", 
                'MA'=&gt;"Massachusetts", 
                'MI'=&gt;"Michigan", 
                'MN'=&gt;"Minnesota", 
                'MS'=&gt;"Mississippi", 
                'MO'=&gt;"Missouri", 
                'MT'=&gt;"Montana",
                'NE'=&gt;"Nebraska",
                'NB'=&gt;"New Brunswick", 
                'NF'=&gt;"Newfoundland", 
                'NS'=&gt;"Nova Scotia", 
                'NV'=&gt;"Nevada",
                'NH'=&gt;"New Hampshire",
                'NJ'=&gt;"New Jersey",
                'NM'=&gt;"New Mexico",
                'NY'=&gt;"New York",
                'NC'=&gt;"North Carolina",
                'ND'=&gt;"North Dakota",
                'NT'=&gt;"Northwest Territories",
                'MB'=&gt;"Manitoba", 
                'OH'=&gt;"Ohio", 
                'OK'=&gt;"Oklahoma", 
                'ON'=&gt;"Ontario", 
                'OR'=&gt;"Oregon", 
                'PA'=&gt;"Pennsylvania", 
                'PE'=&gt;"Prince Edward Island", 
                'QC'=&gt;"Quebec", 
                'RI'=&gt;"Rhode Island", 
                'SC'=&gt;"South Carolina", 
                'SD'=&gt;"South Dakota",
                'SK'=&gt;"Saskatchewan", 
                'TN'=&gt;"Tennessee", 
                'TX'=&gt;"Texas", 
                'UT'=&gt;"Utah", 
                'VT'=&gt;"Vermont", 
                'VA'=&gt;"Virginia", 
                'WA'=&gt;"Washington", 
                'WV'=&gt;"West Virginia", 
                'WI'=&gt;"Wisconsin", 
                'WY'=&gt;"Wyoming",
                'YT'=&gt;"Yukon Territory");
        return $state_list;
    }

    function countries_list()
    {

        $countries = array(
            ''=&gt;'',
            "US"=&gt;"UNITED STATES",
            "CA"=&gt;"CANADA",
            "AU"=&gt;"AUSTRALIA",
            "FR"=&gt;"FRANCE",
            "DE"=&gt;"GERMANY",
            "IT"=&gt;"ITALY",
            "IE"=&gt;"IRELAND",
            "JP"=&gt;"JAPAN",
            "NZ"=&gt;"NEW ZEALAND",
            "ZA"=&gt;"SOUTH AFRICA",
            "SE"=&gt;"SWEDEN", 
            "CH"=&gt;"SWITZERLAND", 
            "GB"=&gt;"UNITED KINGDOM",            
            /*"AF"=&gt;"AFGHANISTAN", 
            "AX"=&gt;"ALAND ISLANDS", 
            "AL"=&gt;"ALBANIA", 
            "DZ"=&gt;"ALGERIA", 
            "AS"=&gt;"AMERICAN SAMOA", 
            "AD"=&gt;"ANDORRA", 
            "AO"=&gt;"ANGOLA", 
            "AI"=&gt;"ANGUILLA", 
            "AQ"=&gt;"ANTARCTICA", 
            "AG"=&gt;"ANTIGUA AND BARBUDA", 
            "AR"=&gt;"ARGENTINA", 
            "AM"=&gt;"ARMENIA", 
            "AW"=&gt;"ARUBA", 
            "AU"=&gt;"AUSTRALIA", 
            "AT"=&gt;"AUSTRIA", 
            "AZ"=&gt;"AZERBAIJAN", 
            "BS"=&gt;"BAHAMAS", 
            "BH"=&gt;"BAHRAIN", 
            "BD"=&gt;"BANGLADESH", 
            "BB"=&gt;"BARBADOS", 
            "BY"=&gt;"BELARUS", 
            "BE"=&gt;"BELGIUM", 
            "BZ"=&gt;"BELIZE", 
            "BJ"=&gt;"BENIN", 
            "BM"=&gt;"BERMUDA", 
            "BT"=&gt;"BHUTAN", 
            "BO"=&gt;"BOLIVIA", 
            "BA"=&gt;"BOSNIA AND HERZEGOVINA", 
            "BW"=&gt;"BOTSWANA", 
            "BV"=&gt;"BOUVET ISLAND", 
            "BR"=&gt;"BRAZIL", 
            "IO"=&gt;"BRITISH INDIAN OCEAN TERRITORY", 
            "BN"=&gt;"BRUNEI DARUSSALAM", 
            "BG"=&gt;"BULGARIA", 
            "BF"=&gt;"BURKINA FASO", 
            "BI"=&gt;"BURUNDI", 
            "KH"=&gt;"CAMBODIA", 
            "CM"=&gt;"CAMEROON", 
            "CV"=&gt;"CAPE VERDE", 
            "CI"=&gt;"C&amp;#226;TE D'IVOIRE", 
            "KY"=&gt;"CAYMAN ISLANDS", 
            "CF"=&gt;"CENTRAL AFRICAN REPUBLIC", 
            "TD"=&gt;"CHAD", 
            "CL"=&gt;"CHILE", 
            "CN"=&gt;"CHINA", 
            "CX"=&gt;"CHRISTMAS ISLAND", 
            "CC"=&gt;"COCOS (KEELING) ISLANDS", 
            "CO"=&gt;"COLOMBIA", 
            "KM"=&gt;"COMOROS", 
            "CG"=&gt;"CONGO", 
            "CD"=&gt;"CONGO, THE DEMOCRATIC REPUBLIC OF THE", 
            "CK"=&gt;"COOK ISLANDS", 
            "CR"=&gt;"COSTA RICA", 
            "HR"=&gt;"CROATIA", 
            "CU"=&gt;"CUBA", 
            "CY"=&gt;"CYPRUS", 
            "CZ"=&gt;"CZECH REPUBLIC", 
            "DK"=&gt;"DENMARK", 
            "DJ"=&gt;"DJIBOUTI", 
            "DM"=&gt;"DOMINICA", 
            "DO"=&gt;"DOMINICAN REPUBLIC", 
            "EC"=&gt;"ECUADOR", 
            "EG"=&gt;"EGYPT", 
            "SV"=&gt;"EL SALVADOR", 
            "GQ"=&gt;"EQUATORIAL GUINEA", 
            "ER"=&gt;"ERITREA", 
            "EE"=&gt;"ESTONIA", 
            "ET"=&gt;"ETHIOPIA", 
            "FK"=&gt;"FALKLAND ISLANDS (MALVINAS)", 
            "FO"=&gt;"FAROE ISLANDS", 
            "FJ"=&gt;"FIJI", 
            "FI"=&gt;"FINLAND", 
            "FR"=&gt;"FRANCE", 
            "GF"=&gt;"FRENCH GUIANA", 
            "PF"=&gt;"FRENCH POLYNESIA", 
            "TF"=&gt;"FRENCH SOUTHERN TERRITORIES", 
            "GA"=&gt;"GABON", 
            "GM"=&gt;"GAMBIA", 
            "GE"=&gt;"GEORGIA", 
            "DE"=&gt;"GERMANY", 
            "GH"=&gt;"GHANA", 
            "GI"=&gt;"GIBRALTAR", 
            "GR"=&gt;"GREECE", 
            "GL"=&gt;"GREENLAND", 
            "GD"=&gt;"GRENADA", 
            "GP"=&gt;"GUADELOUPE", 
            "GU"=&gt;"GUAM", 
            "GT"=&gt;"GUATEMALA", 
            "GN"=&gt;"GUINEA", 
            "GW"=&gt;"GUINEA-BISSAU", 
            "GY"=&gt;"GUYANA", 
            "HT"=&gt;"HAITI", 
            "HM"=&gt;"HEARD ISLAND AND MCDONALD ISLANDS", 
            "VA"=&gt;"HOLY SEE (VATICAN CITY STATE)", 
            "HN"=&gt;"HONDURAS", 
            "HK"=&gt;"HONG KONG", 
            "HU"=&gt;"HUNGARY", 
            "IS"=&gt;"ICELAND", 
            "IN"=&gt;"INDIA", 
            "ID"=&gt;"INDONESIA", 
            "IR"=&gt;"IRAN ISLAMIC REPUBLIC OF", 
            "IQ"=&gt;"IRAQ", 
            "IE"=&gt;"IRELAND", 
            "IL"=&gt;"ISRAEL", 
            "IT"=&gt;"ITALY", 
            "JM"=&gt;"JAMAICA", 
            "JP"=&gt;"JAPAN", 
            "JO"=&gt;"JORDAN", 
            "KZ"=&gt;"KAZAKHSTAN", 
            "KE"=&gt;"KENYA", 
            "KI"=&gt;"KIRIBATI", 
            "KP"=&gt;"KOREA DEMOCRATIC PEOPLE\'S REPUBLIC OF", 
            "KR"=&gt;"KOREA REPUBLIC OF", 
            "KW"=&gt;"KUWAIT", 
            "KG"=&gt;"KYRGYZSTAN", 
            "LA"=&gt;"LAO PEOPLE\'S DEMOCRATIC REPUBLIC", 
            "LV"=&gt;"LATVIA", 
            "LB"=&gt;"LEBANON", 
            "LS"=&gt;"LESOTHO", 
            "LR"=&gt;"LIBERIA", 
            "LY"=&gt;"LIBYAN ARAB JAMAHIRIYA", 
            "LI"=&gt;"LIECHTENSTEIN", 
            "LT"=&gt;"LITHUANIA", 
            "LU"=&gt;"LUXEMBOURG", 
            "MO"=&gt;"MACAO", 
            "MK"=&gt;"MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF", 
            "MG"=&gt;"MADAGASCAR", 
            "MW"=&gt;"MALAWI", 
            "MY"=&gt;"MALAYSIA", 
            "MV"=&gt;"MALDIVES", 
            "ML"=&gt;"MALI", 
            "MT"=&gt;"MALTA", 
            "MH"=&gt;"MARSHALL ISLANDS", 
            "MQ"=&gt;"MARTINIQUE", 
            "MR"=&gt;"MAURITANIA", 
            "MU"=&gt;"MAURITIUS", 
            "YT"=&gt;"MAYOTTE", 
            "MX"=&gt;"MEXICO", 
            "FM"=&gt;"MICRONESIA, FEDERATED STATES OF", 
            "MD"=&gt;"MOLDOVA, REPUBLIC OF", 
            "MC"=&gt;"MONACO", 
            "MN"=&gt;"MONGOLIA", 
            "MS"=&gt;"MONTSERRAT", 
            "MA"=&gt;"MOROCCO", 
            "MZ"=&gt;"MOZAMBIQUE", 
            "MM"=&gt;"MYANMAR", 
            "NA"=&gt;"NAMIBIA", 
            "NR"=&gt;"NAURU", 
            "NP"=&gt;"NEPAL", 
            "NL"=&gt;"NETHERLANDS", 
            "AN"=&gt;"NETHERLANDS ANTILLES", 
            "NC"=&gt;"NEW CALEDONIA", 
            "NZ"=&gt;"NEW ZEALAND", 
            "NI"=&gt;"NICARAGUA", 
            "NE"=&gt;"NIGER", 
            "NG"=&gt;"NIGERIA", 
            "NU"=&gt;"NIUE", 
            "NF"=&gt;"NORFOLK ISLAND", 
            "MP"=&gt;"NORTHERN MARIANA ISLANDS", 
            "NO"=&gt;"NORWAY", 
            "OM"=&gt;"OMAN", 
            "PK"=&gt;"PAKISTAN", 
            "PW"=&gt;"PALAU", 
            "PS"=&gt;"PALESTINIAN TERRITORY, OCCUPIED", 
            "PA"=&gt;"PANAMA", 
            "PG"=&gt;"PAPUA NEW GUINEA", 
            "PY"=&gt;"PARAGUAY", 
            "PE"=&gt;"PERU", 
            "PH"=&gt;"PHILIPPINES", 
            "PN"=&gt;"PITCAIRN", 
            "PL"=&gt;"POLAND", 
            "PT"=&gt;"PORTUGAL", 
            "PR"=&gt;"PUERTO RICO", 
            "QA"=&gt;"QATAR", 
            "RE"=&gt;"REUNION", 
            "RO"=&gt;"ROMANIA", 
            "RU"=&gt;"RUSSIAN FEDERATION", 
            "RW"=&gt;"RWANDA", 
            "SH"=&gt;"SAINT HELENA", 
            "KN"=&gt;"SAINT KITTS AND NEVIS", 
            "LC"=&gt;"SAINT LUCIA", 
            "PM"=&gt;"SAINT PIERRE AND MIQUELON", 
            "VC"=&gt;"SAINT VINCENT AND THE GRENADINES", 
            "WS"=&gt;"SAMOA", 
            "SM"=&gt;"SAN MARINO", 
            "ST"=&gt;"SAO TOME AND PRINCIPE", 
            "SA"=&gt;"SAUDI ARABIA", 
            "SN"=&gt;"SENEGAL", 
            "CS"=&gt;"SERBIA AND MONTENEGRO", 
            "SC"=&gt;"SEYCHELLES", 
            "SL"=&gt;"SIERRA LEONE", 
            "SG"=&gt;"SINGAPORE", 
            "SK"=&gt;"SLOVAKIA", 
            "SI"=&gt;"SLOVENIA", 
            "SB"=&gt;"SOLOMON ISLANDS", 
            "SO"=&gt;"SOMALIA", 
            "ZA"=&gt;"SOUTH AFRICA", 
            "GS"=&gt;"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS", 
            "ES"=&gt;"SPAIN", 
            "LK"=&gt;"SRI LANKA", 
            "SD"=&gt;"SUDAN", 
            "SR"=&gt;"SURINAME", 
            "SJ"=&gt;"SVALBARD AND JAN MAYEN", 
            "SZ"=&gt;"SWAZILAND", 
            "SE"=&gt;"SWEDEN", 
            "CH"=&gt;"SWITZERLAND", 
            "SY"=&gt;"SYRIAN ARAB REPUBLIC", 
            "TW"=&gt;"TAIWAN PROVINCE OF CHINA", 
            "TJ"=&gt;"TAJIKISTAN", 
            "TZ"=&gt;"TANZANIA UNITED REPUBLIC OF", 
            "TH"=&gt;"THAILAND", 
            "TL"=&gt;"TIMOR-LESTE", 
            "TG"=&gt;"TOGO", 
            "TK"=&gt;"TOKELAU", 
            "TO"=&gt;"TONGA", 
            "TT"=&gt;"TRINIDAD AND TOBAGO", 
            "TN"=&gt;"TUNISIA", 
            "TR"=&gt;"TURKEY", 
            "TM"=&gt;"TURKMENISTAN", 
            "TC"=&gt;"TURKS AND CAICOS ISLANDS", 
            "TV"=&gt;"TUVALU", 
            "UG"=&gt;"UGANDA", 
            "UA"=&gt;"UKRAINE", 
            "AE"=&gt;"UNITED ARAB EMIRATES", 
            "GB"=&gt;"UNITED KINGDOM", 
            "UM"=&gt;"UNITED STATES MINOR OUTLYING ISLANDS", 
            "UY"=&gt;"URUGUAY", 
            "UZ"=&gt;"UZBEKISTAN", 
            "VU"=&gt;"VANUATU", 
            "VE"=&gt;"VENEZUELA", 
            "VN"=&gt;"VIETNAM", 
            "VG"=&gt;"VIRGIN ISLANDS BRITISH", 
            "VI"=&gt;"VIRGIN ISLANDS U.S.", 
            "WF"=&gt;"WALLIS AND FUTUNA", 
            "EH"=&gt;"WESTERN SAHARA", 
            "YE"=&gt;"YEMEN", 
            "ZM"=&gt;"ZAMBIA", 
            "ZW"=&gt;"ZIMBABWE"*/
        );             
        return $countries;
    }

    function geocodeYahoo($params){
        $app_id='Ah6w9S72';//CherieCheriMeet via dreamcodev@gmail.com
        $zip=explode('|',$params);
        $address=str_replace(" ","+",trim($zip[0]));
        $url='http://where.yahooapis.com/geocode?q='.$address.'&amp;appid='.$app_id;
        $response = file_get_contents($url);
        $geocode=new SimpleXMLElement($response);
        //echo "&lt;pre&gt;".print_r($geocode,true)."&lt;/pre&gt;";
        $return=array(
            "latitude"=&gt;(float)$geocode-&gt;Result-&gt;latitude,
            "longitude"=&gt;(float)$geocode-&gt;Result-&gt;longitude,
            "city"=&gt;(string)$geocode-&gt;Result-&gt;city,
            "state"=&gt;(string)$geocode-&gt;Result-&gt;state,
            "state_short"=&gt;(string)$geocode-&gt;Result-&gt;statecode,
            "uzip"=&gt;(string)$geocode-&gt;Result-&gt;longitude,
            "country"=&gt;(string)$geocode-&gt;Result-&gt;country,
            "country_short"=&gt;(string)$geocode-&gt;Result-&gt;countrycode,
        );
        return $return;
    }

    function geocodeGoogle($params)
    {   
        $zip=explode('|',$params);
        $address=str_replace(" ","+",trim($zip[0]));
        $url = "http://maps.google.com/maps/api/geocode/json?address=".$address."&amp;output=csv&amp;sensor=false";
        if(!empty($zip[1])){
            $url.='&amp;region='.$zip[1];
        }

        $response = file_get_contents($url);
        $response = json_decode($response);

        $address = $response-&gt;results[0]-&gt;address_components;
        //$country=$zip[1];
        foreach($address as $a){
            $type=$a-&gt;types[0];
            if($type=="country"){
                $country=$a-&gt;short_name;
            }
        }
        $response = $response-&gt;results[0]-&gt;geometry-&gt;location;
        //echo "&lt;pre&gt;";print_r($response);echo "&lt;/pre&gt;";
        $return = array('latitude' =&gt; $response-&gt;lat, 'longitude' =&gt; $response-&gt;lng,'country'=&gt;$country);
        //print_r($return);
        return $return;
    }
    function geocodeCountryCode($zip){
        $url = "http://maps.google.com/maps/api/geocode/json?address={$zip}&amp;output=csv&amp;sensor=false";
        $response = file_get_contents($url);
        $response = json_decode($response);
        //echo "&lt;pre&gt;";print_r($response);echo "&lt;/pre&gt;";
        $response = $response-&gt;results[0]-&gt;address_components;

        $return=array();
        foreach($response as $r){
            $type=$r-&gt;types[0];
            if($type=="country"){
                $return=$r-&gt;short_name;
            }
        }
        return $return;
    }
    function geocodeAddress($zip){
        $zip=explode('|',$zip);
        $url = "http://maps.google.com/maps/api/geocode/json?address={$zip[0]}&amp;output=csv&amp;sensor=false";
        if(!empty($zip[1])){
            $url.='&amp;region='.$zip[1];
        }
        $response = file_get_contents($url);
        $response = json_decode($response);
        //echo "&lt;pre&gt;";print_r($response);echo "&lt;/pre&gt;";
        $response = $response-&gt;results[0]-&gt;address_components;

        $return=array();
        foreach($response as $r){
            $type=$r-&gt;types[0];
            if($type=="locality" | $type=="administrative_area_level_1" | $type=="country"){
                $return[]=$r-&gt;long_name;
            }
        }
        return implode(', ',$return);
    }
    function geocodeData($zip){
        $url = "http://maps.google.com/maps/api/geocode/json?address={$zip}&amp;output=csv&amp;sensor=false";
        $response = file_get_contents($url);
        $response = json_decode($response);
        //echo "&lt;pre&gt;";print_r($response);echo "&lt;/pre&gt;";
        $response = $response-&gt;results[0];
        return $response;
    }    
    function get_inbox_unread($uid = '')
    {
        $this-&gt;db-&gt;select('cid');
        $q = $this-&gt;db-&gt;get_where('messages', array('owner_id' =&gt; $uid, 'status'=&gt; 0, 'box'=&gt;0));
        return $q-&gt;num_rows();
    }
}
?&gt;​
</code></pre>
