In drupal we can create fields through UI given by Drupal.
Like we can create the list type field and also we can put more and more data to that fields using the UI,
But its really a hard job to get those values without the knowledge of Drupal Core coding.
At time of storing those values ZERO knowledge of drupal coding is required but to get those valuse to
use it in other modules you need to understand about the Drupal Database structure as well as few lines of code.
After creating a field in Drupal we can head for the database and just search for a table called field_config.
There you can find a column called field_name . Just Search for your field name that you have created at
the type of field creation and Copy that field name from that table.
In your own Drupal module you need to write just two lines of code like follows
$dropDownListData = field_info_fields(); $optionsdesc= list_allowed_values($dropDownListData["field_mygroup"]);
In the above example field_mygroup is the field name that i copied from field_config database table.
$optionsdesc contains the array of data in key value pair (associative array).
The contains of this variable will be something like this
$optionsdesc = array (1=> 'jatni' , 2=> 'bhubaneswar' , 3=>'orissa')
Just use with drupal form to create a drop down list by own like follows.
1 2 3 4 5 6 7
$form['desc_id'] = array( '#type' => 'select', '#title' => t('Name of the description'), '#options' =>$optionsdesc, '#default_value' => 0, '#required' => TRUE, );
This how we can retrieve drupal’s data from database and create the field of own wish.