How to display the table select query values in the same form in drupal 7? Just newly working on Drupal 7. Using Form API I created a text field with one submit button. I need to pass the text field's value in the select query as a parameter. I need to output the result set of the select query in table layout. Please help me out by providing a set of codes.
This is actually very easily done out of the box with form-api, you just have to know how to use it. You have to read up on drupal 7 forms, especially the validate and submit functions/hooks. A quick and dirty example to output form values in submit function (called after function form_*_validate() hook) is shown below.

function form_example_tutorial_7_submit($form, &amp;$form_state) {
  drupal_set_message(t('The form has been submitted. name="@first @last", year of birth=@year_of_birth', 
    array('@first' =&gt; $form_state['values']['first'], '@last' =&gt; $form_state['values']['last'], '@year_of_birth' =&gt; $form_state['values']['year_of_birth'])));
}


Of course, you can also show messages like this in the validation step. You would need to change above code to use whatever variables you want shown.  

Tons of very helpful form api code examples here.

If videos are more your thing, these explains the basic basics ok. 

Cheers!