Link to home
Create AccountLog in
Avatar of drupal_100
drupal_100Flag for United States of America

asked on

drupal 7 Query database and display results after form submit in custom module

function mymodule_search_form($form, &$form_state) {

  $form..... define the form here

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Search',
  );

  return $form;
}

function mymodule_search_form_submit($form, &$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;
}

So basically I want to have a form to search something from database.
Once click the submit to search, and get the result.

I want to display the result just under the form in the same form page.
DO NOT GO TO ANOTHER PAGE, JUST IN THE ORIGINAL FORM PAGE.

The form can be clean/reset into original status, which is fine.

http://drupal.org/node/542646
This discussion is what I want, but there looks no solid result/solution there.
ASKER CERTIFIED SOLUTION
Avatar of stephencolson
stephencolson
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer