how to get the submitted value of tableselect function test($form, &amp;$form_state){
   $form = array();

   $header = array(.............);

   $values = array(.............);

   $form['table'] = array(
      '#type' =&gt; 'tableselect',
      '#header' =&gt; $header,
      '#options' =&gt; $rows,
      '#multiple' =&gt; $IsCheckbox,
      '#empty' =&gt; t('No users found'),
    );
    $form['submit'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; t('Submit'),
    );
  return $form; 
} // end of function test()

function test_submit($form, &amp;$form_state){

$selected = $form_state['values']['table'];

drupal_set_message($selected)  // displays array index (0,1,2 etc)

return;
}


How to get the selected table row values in Drupal form. Need assistance on the issue. Any help would be appreciated.
You can exclude unselected options with array_filter, e.g.

$selected = array_filter($form_state['values']['table']);