Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. $results = db_select('users', 'u') ->fields('u',array('name','uid','mail')) ->execute();
  2. $options = array();
  3. foreach ($results as $result) {
  4. $options[$result->uid] = $result->name.' | '.$result->mail;
  5. }
  6. unset($options[array_search(0, $options)]);
  7. $form['user'] = array(
  8. '#type' => 'select',
  9. '#title' => t('Select User'),
  10. '#options' => $options,
  11. '#default_value'=>('select a value'),
  12. '#states' => array(
  13. 'visible' => array(
  14. ':input[name="data_set"]' => array('value' => 'education'),
  15. ),
  16. ),
  17. );
  18. $form['submit']=array(
  19. '#type'=>'submit',
  20. '#value'=>t('Expire')
  21. );
  22.  
  23. $options = array('_none' => '-select item-') + $options; //Places an extra option at the start
  24.  
  25. // Use the array key, not the value.
  26. '#default_value' => '_none',
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement