Impossible to get my pager I need to show in the same page a form and a table which shows all results from a webservice response.

function collectivite_search_user_form($form, &amp;$form_state) {
    $form['name'] = array(
      '#type' =&gt; 'textfield',
      '#title' =&gt; t('Name'),
      '#required'   =&gt; True,
    );
    $form['firstname'] = array(
      '#type' =&gt; 'textfield',
      '#title' =&gt; t('Firstname'),
      //'#required'   =&gt; True,
    );
    $form['submit'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; t('Submit'),
    );
    if (isset($form_state['table'])) {
        $form['table'] = $form_state['table'];
    }
    return $form;
}


function collectivite_search_user_form_submit($form, &amp;$form_state) {
    module_load_include('inc', 'collectivite', 'collectivite.api');
    $results = collectivite_ws_get_users($form_state['values']['name'], $form_state['values']['firstname']);
    if(is_object($results-&gt;Dossier)){
            $rows[] = array(
                'id'       =&gt; $results-&gt;Dossier-&gt;id,
                'nom'       =&gt; $results-&gt;Dossier-&gt;nom,
                'prenom'    =&gt; $results-&gt;Dossier-&gt;prenom,
            );
    }else{
        foreach($results-&gt;Dossier as $dossier) {        
            $rows[] = array(
                'id'       =&gt; $dossier-&gt;id,
                'nom'       =&gt; $dossier-&gt;nom,
                'prenom'    =&gt; $dossier-&gt;prenom,
            );
        }

    }


    $paging = pager_array_splice($rows, 5);
    $header = array(t('id'), t('name'), t('firstname'));

    $form_state['table'] = array(
      '#theme' =&gt; 'table',
      '#header' =&gt; $header,
      '#rows' =&gt; $paging,
      '#empty' =&gt; t('Aucun résultat.')
    );
    $form_state['rebuild'] = True;
}

function pager_array_splice($data, $limit = 9, $element = 0) {
  global $pager_page_array, $pager_total, $pager_total_items;
  $page = isset($_GET['page']) ? $_GET['page'] : '';

  // Convert comma-separated $page to an array, used by other functions.
  $pager_page_array = explode(',', $page);

  // We calculate the total of pages as ceil(items / limit).
  $pager_total_items[$element] = count($data);
  $pager_total[$element] = ceil($pager_total_items[$element] / $limit);
  $pager_page_array[$element] = max(0, min((int)$pager_page_array[$element], ((int)$pager_total[$element]) - 1));
  return array_slice($data, $pager_page_array[$element] * $limit, $limit, TRUE);
}


It works fine except I cannot see the pagination. Can you see where is the problem ?

Thanks
function pager_array_splice($data, $limit = 9, $element = 0) {
      global $pager_page_array, $pager_total, $pager_total_items;
      $page = isset($_GET['page']) ? $_GET['page'] : '';

      // Convert comma-separated $page to an array, used by other functions.
      $pager_page_array = explode(',', $page);

      // We calculate the total of pages as ceil(items / limit).
      $pager_total_items[$element] = count($data);
      $pager_total[$element] = ceil($pager_total_items[$element] / $limit);
      $pager_page_array[$element] = max(0, min((int)$pager_page_array[$element], ((int)$pager_total[$element]) - 1));
      return array_slice($data, $pager_page_array[$element] * $limit, $limit, TRUE);
    }

    $output = pager_array_splice($yourarray, 5); 


$output = '';
  $your_array = some_method_to_get_array();
  $tree = pager_array_splice($your_array, 5);
  // Do something with the 5 terms
  $output .= theme('pager', array('quantity' => 5));