I have been recently trying to use drupal as an itranet based CMS for my company and i started out by using CCK to create my custom nodes. I noticed that CCK, although powerfull is in places, a little limted. I decided to write my own modules to get the structure i wanted. What i an looking for is when i create my form for my module. I want to have a pull down menu that is generated from another table in my database. So instead of a simple pull down menu like this:
$form['basic_attributes']['personal_title'] = array(
'#type' => 'select',
'#title' => t('Title'),
'#default_value' => $node->personal_title,
'#options' => array(
'Mr' => 'Mr',
'Mrs' => 'Mrs',
'Miss' => 'Miss',
'Ms' => 'Ms'
),
'#description' => t('Please choose an option.'),
);
I want to create something like this: (this is NOT the actual syntax, just an explanation)
// Load the data to create the menu
$record = query(SELECT * FROM pull_down_menu_table);
$form['basic_attributes']['personal_title'] = array(
'#type' => 'select',
'#title' => t('Title'),
'#default_value' => $node->personal_title,
// Generate the pull down options
foreach $record blah blah blah
),
'#description' => t('Please choose an option.'),
);