Building a Custom Search block
I created two forms and called the second one only after the first form is submitted. To create a table i used table theme.

if (!empty($form_state['values']['text'])) {


 //db_query here to search the key word
 $text = $form_state['values']['text'];
$header=array(t('patient id'), t('patient name'));
$row = array( 
    array(
t('one'),t('two')
    ),
);

 $form['table']=array(
 '#theme'=&gt;'table',
 '#header'=&gt;$header,
 '#rows'=&gt;$row,
 ); 
 }
 else {

 $form['text'] = array(
'#type' =&gt; 'textfield',
'#title' =&gt; t('patient_id'
));

 $form['buttons']['submit'] = array(
'#type' =&gt; 'submit',
'#value' =&gt; t('Submit Button'),
//'#ajax'=&gt; array('callback'=&gt;'anonymous_page'),

); 
}
return $form;
}


in the form submit add 

$form_state['rebuild']=true;