How to query the database to create a report based on user input variables in a form? I am creating an example report of user data based on selection criteria selected in a form. I can create the form variables, and I can redirect the user to the report output page, but how do I include the selection criteria variables in the redirect? Here is my module code:

&lt;?php
/**
 * @file
 * Example form module that creates a users report.
 */

/**
 * Implements hook_menu().
 */
function example_form_menu() {
  $items = array();
  $items['example-form'] = array(
    'title' =&gt; 'Example Form',
    'description' =&gt; 'Provides search criteria for the Users report',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('example_form_create_form'),
    'access arguments' =&gt; array('access content'),
    'type' =&gt; MENU_NORMAL_ITEM,
  );

  $items['example-form-output'] = array(
    'title' =&gt; 'Report output',
    'description' =&gt; 'Output page for Users report',
    'page callback' =&gt; 'example_form_output_page',
    'access arguments' =&gt; array('access content'),
  );
  return $items;
}

/**
 * Creates a form.
 */
function example_form_create_form($form, &amp;$form_submit) {
  $form['title'] = array(
    '#title' =&gt; t('User'),
    '#type' =&gt; 'textfield',
    '#description' =&gt; 'Search for a User.',
  );

  $form['user-date-created-comparison'] = array(
    '#title' =&gt; t('Creation Date'),
    '#type' =&gt; 'select',
    '#options' =&gt; drupal_map_assoc(
      array(
        t('is greater than:'),
        t('is less than:'),
        t('is equal to:'),
      )
    ),
    '#empty_option' =&gt; '',
  );

  $form['user-created-date'] = array(
    '#type' =&gt; 'date_popup',
    '#date_format' =&gt; 'm/d/Y',
    '#date_label_position' =&gt; 'within',
  );

  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; 'Submit',
  );

  return $form;
}

/**
 * Implements hook_form_alter().
 */
function example_form_form_alter(&amp;$form, $form_state, $form_id) {
  if ($form_id == "example_form_create_form") {
    $form['submit']['#submit'][] = 'example_form_redirect_handler';
  }
}

/**
 * Attaches the redirect to the submitted form.
 */
function example_form_redirect_handler($form, &amp;$form_state) {

  $form_state['redirect'] = 'example-form-output';
}

/**
 * Creates the report output page.
 */
function example_form_output_page() {

  // Here is where I am stuck. How do I access the form variables?

  // Call db_select()

  $html = "&lt;h1&gt;Report Output:&lt;/h1&gt;";

  // Display users, roles, creation date, etc. based on the search
  // criteria supplied in the form.

  return $html;
}
I think you pass some arguments when you redirect the page to another page.
You can pass arguments like this way.. 

$form_state['redirect'] = array(
  'node/123',
  array(
    'query' =&gt; array(
      'foo' =&gt; 'bar',
    ),
    'fragment' =&gt; 'baz',
  ),
);


Or You also can use drupal_goto() like this

drupal_goto('your_url', array('query'=&gt;array(
'variable_name1'=&gt;'variable_value1',
'variable_name2'=&gt;'variable_value2',
'variable_name3'=&gt;'variable_value3',
...... ...
)));


You can check below links for more information.
https://api.drupal.org/api/drupal/includes!form.inc/function/drupal_redirect_form/7
https://www.drupal.org/node/291680
https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_goto/7

Note : Ignore to use this options.
And last options is $_SESSION variable. you can store your data in session and after  getting data from session in your destination page you unset that particular  session data.