Make custom form submit data to view filters I have a custom-generated form on a page and it needs to submit data to a view on a different page. I'm currently trying to get this to work by passing the form #validate through a submit hook and then using $form_state['redirect'] = 'customsearch/'; to catch the results. The view has several exposed filters and will ideally set themselves to the data received from the initial custom form page.

It doesn't look as though data is actually making it to the /customsearch/ landing page however. I have enabled the Views Expost module and am watching for POST variables from a PHP field in the landing page view.

The current code including form, validation and redirection can be found over here.

What is the proper 'Drupal' way of passing data from a form to a view with exposed filters? Should I be watching for GET or POST variables or will Drupal pass data with a different set of functions than the ones currently used?
Views exposed filters are using information supplied by the relevant GET parameters so this use case is actually very simple. You only need to build the correct url in your custom form submit handler from the received data and then redirect the user. A basic example to illustrate this:

function mymodule_custom_search_form($form, &amp;$form_state) {
  $form['key1'] = array(
    '#title' =&gt; t('Key1'),
    '#type' =&gt; 'textfield',
  );
  $form['key2'] = array(
    '#title' =&gt; t('Key2'),
    '#type' =&gt; 'textfield',
  );
  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Search'),
  );

  return $form;
}

function mymodule_custom_search_form_submit($form, &amp;$form_state) {
  $options = array('absolute' =&gt; TRUE);
  $key1 = trim($form_state['values']['key1']);
  if ($key1) {
    $options['query']['key1'] = $key1;
  }
  $key2 = trim($form_state['values']['key2']);
  if ($key2) {
    $options['query']['key2'] = $key2;
  }
  $form_state['redirect'] = url('customsearch', $options);
}


If the user submits the form with "key1" value "one" and "key2" value "two" then they will be redirected to "customsearch?key1=one&amp;key2=two". What you need to note is that the GET parameters "key1" and "key2" must match with what you've set in the relevant view: click on your filter criteria -> "MORE" link at the bottom and then check/modify "Filter identifier".