How to programmatically display a select list label instead of the value? I created a select list box in the following format

Gender
1|Male
2|Female


I want to display the follwing information in a table but I am getting "1" for male and "2" for female. 

Here is my code:

function display_results_submissions(){
$results = db_query("SELECT * FROM {users}");
$header = array( t('Name'), t('Mail'), t('Gender'),);

foreach($results as $result){
        $rows[] = array(

            $result-&gt;name,
            $result-&gt;mail,
            $result-&gt;gender,

            );
    }

    return theme('table', array('header' =&gt; $header, 'rows'=&gt;$rows));
}


I want to display Male or Female instead of "1" and "2". How can I do so?
I think you should use entity_metadata_wrapper because when the select label changes you don't have to change your code.

Following lines will do what you want:

$wrapper = entity_metadata_wrapper('user', $result-&gt;uid);
$gender = $wrapper-&gt;field_user_gender-&gt;label();


So your code would look like:

function display_results_submissions(){
  $results = db_query("SELECT * FROM {users}");
  $header = array(t('Name'), t('Mail'), t('Gender'));
  foreach($results as $result){
    $wrapper = entity_metadata_wrapper('user', $result-&gt;uid);
    $gender = $wrapper-&gt;field_user_gender-&gt;label();
    $rows[] = array(
      $result-&gt;name,
      $result-&gt;mail,
      $gender,
    );
  }

  return theme('table', array('header' =&gt; $header, 'rows' =&gt; $rows));
}


There is a good blog post at http://www.mediacurrent.com/blog/entity-metadata-wrapper