title: drupal 7 Query database and display results after form submit in custom module
body: <pre><code>function mymodule_search_form($form, &amp;$form_state) {
  
    $form..... define the form here
  
    $form['submit'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; 'Search',
    );
  
    return $form;
  }
  
  function mymodule_search_form_submit($form, &amp;$form_state) {
  
    //process the form and get result 
    $output = this is the result with a table of data.
    //I want to display the result table here.
  
   //Now I can only use drupal message to display on top.
   drupal_set_message($output);
  
    return;
  }
  </code></pre>
  
  <p>So basically I want to have a form to search something from database.
  Once click the submit to search, and get the result.</p>
  
  <p>I want to display the result just under the form in the same form page.
  <strong>Do not go to another page, just in the original form page.</strong></p>
  
  <p>The form can be clean/reset into original status, which is fine.</p>
  
  <p><a href="http://drupal.org/node/542646" rel="noreferrer">http://drupal.org/node/542646</a>
  This discussion is what I want, but there looks no solid result/solution there.</p>