How do you add a custom search box at code level? I have a Drupal 6 site that runs Apache Solr. I need to programmatically add a search form to a custom block that is created by code.

Here is what I'm using:

  $form = array();

  $form['#action'] = 'sitesearch/';

  // search form
  $form['keys'] = array(
    '#title' =&gt; NULL,
    '#type' =&gt; 'textfield',
    '#value' =&gt; t('Search for questions and answers'),
  );

  // add in the click in erase routine
  $form['keys']['#attributes'] = array(
    'class' =&gt; 'NormalTextBox txtSearch', 
    'onblur' =&gt; "if (this.value == '') {this.value = '" . $form['keys']['#value'] . "';} ;",
    'onfocus' =&gt; "if (this.value == '" . $form['keys']['#value'] . "') {this.value = '';} ;"
  );

  $form['submit'] = array(
    '#value' =&gt; t('Search'),
    '#type' =&gt; 'submit',
    '#attributes' =&gt; array('class' =&gt; 'filtered-search-form-submit'),
  );

  return $form;


When I submit the form I get to the search results page but it's blank, as if nothing was searched. Any ideas or guidance would be great.
I'm pretty brain-dead. I just set up a custom submit handler for a custom form for search to redirect after form submission to the search results page with the right URL, e.g., passing the query and filter in manually.