Form and Table on same page I got a Form and a Table displayed on the same page. The weird thing is that when the form is submitted and the page are reloaded (after doing a database SELECT) with $_POST values, the table is not showing....why?

Here is the code (suppose $tabb2 have correct table data):

&lt;?php 

function collabinc_menu($may_cache) {
  $items = array();
  $items['admin/reporting/report_details2'] = array(
    'title' =&gt; 'Report: User details by stores',
    'access arguments' =&gt; array('access content'),
    'page callback' =&gt; 'say_report_details2',
    'type' =&gt; MENU_CALLBACK,
  );  
  return $items;
}

function say_report_details2($values = array()) {
  $output = "";

  if (isset ($_POST['search'])) {
     $output = theme("table", $tabb2);
  }

  $build['content'] = array(
    'this_does_not_matter_too_much2' =&gt; drupal_get_form("report_details_form"),       
    'this_does_not_matter_too_much1' =&gt; array('#markup' =&gt; $output,),);

  return $build;
}


Please note that both Form and Table are working, and displayed correctly at the same time when not putting the "if (isset ($_POST['search']))" condition. Also note that the condition is fully working and checked. 

Thanks!
You can use the Table theme. Example :-

$form['data_field'] = array(
'#type' =&gt; 'textfield',
'#title' =&gt; t('Search!'),
'#id'   =&gt; 'search',
'#maxlength' =&gt; 1024,
'#description' =&gt; t('Search by using tags and free text'),
);
$form['submit'] = array(
'#type' =&gt; 'submit',
'#value' =&gt; 'Go!!',
);
...
...
fill $table
...
...
if(sizeof($form_state['input'])!=0) {

$form['table'] = array(
'#theme' =&gt; 'table',
'#header' =&gt; $header,
'#rows' =&gt; $rows,
'#empty' =&gt; t('Empty Rows')
);
}
return $form.