Get id of selected option in Drupal Forms API I have a select element in my form. 

function myid_print_user_page_form($form, &amp;$form_state)
{
    $form = array();
    $form['options'] = array(
        '#type' =&gt; 'select',        
        '#options' =&gt; array(
            0 =&gt; t('All'),
            1 =&gt; t("Printed ID's"),
            2 =&gt; t("Unprinted ID's"),
        ),
        '#default_value' =&gt; 0,             
        '#ajax' =&gt; array(
            'callback' =&gt; 'myid_print_all_submitted_id_callback',
            'wrapper' =&gt; 'myid_print_search_idnumber_wrapper',
        ),                             
    );

    $form['myid_print_search_idnumber_wrapper'] = array(
       '#type' =&gt; 'item',      
       '#markup' =&gt; '&lt;div id= "myid_print_search_idnumber_wrapper"&gt;&lt;/div&gt;'                               
    );
    return $form;
}   


I'm stuck in the callback function. It always return 1, even though I selected other options.

function myid_print_all_submitted_id_callback($form, $form_state)
{
    return $form_state['values']['options'];
}


Where am I missing?
You can use this code

function myid_print_user_page_form($form, &amp;$form_state)
{
    $form = array();
    $form['options'] = array(
        '#type' =&gt; 'select',        
        '#options' =&gt; array(
            0 =&gt; t('All'),
            1 =&gt; t("Printed ID's"),
            2 =&gt; t("Unprinted ID's"),
        ),
        '#default_value' =&gt; 0,             
        '#ajax' =&gt; array(
            'callback' =&gt; 'myid_print_all_submitted_id_callback',
            'wrapper' =&gt; 'myid_print_search_idnumber_wrapper',
        ),                             
    );

    $form['myid_print_search_idnumber_wrapper'] = array(
       '#type' =&gt; 'item', 
    // When the form is rebuilt during ajax processing, the $selected variable
    // will now have the new value and so the options will change.     
       '#markup' =&gt; isset($form_state['values']['options']) ? $form_state['values']['options'] : '',     
       '#prefix' =&gt; '&lt;div id="myid_print_search_idnumber_wrapper"&gt;',
       '#suffix' =&gt; '&lt;/div&gt;',                              
    );
    return $form;
}   
function myid_print_all_submitted_id_callback($form, $form_state){
// rebuild the form
    return $form['myid_print_search_idnumber_wrapper'];
}