How to get country list from locations module ?

    You can get country list array using following function :
    <?php
    //Simple array of countries
    $list = location_get_iso3166_list(); //Defined inside location.inc

    //Options list to use in form
    $options = array_merge(array('' => t('Please select'), 'xx' => t('NOT LISTED')), location_get_iso3166_list());

    $form['yourcountry'] = array(
     
    '#type' => 'select',
     
    '#title' => t('Your Country'),
     
    '#options' => $options,
    );
    ?>
    5
    Average: 5 (1 vote)