Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $results = db_select('users', 'u') ->fields('u',array('name','uid','mail')) ->execute();
- $options = array();
- foreach ($results as $result) {
- $options[$result->uid] = $result->name.' | '.$result->mail;
- }
- unset($options[array_search(0, $options)]);
- $form['user'] = array(
- '#type' => 'select',
- '#title' => t('Select User'),
- '#options' => $options,
- '#default_value'=>('select a value'),
- '#states' => array(
- 'visible' => array(
- ':input[name="data_set"]' => array('value' => 'education'),
- ),
- ),
- );
- $form['submit']=array(
- '#type'=>'submit',
- '#value'=>t('Expire')
- );
- $options = array('_none' => '-select item-') + $options; //Places an extra option at the start
- // Use the array key, not the value.
- '#default_value' => '_none',
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement