how to overwrite the search box? &lt;div class="fr_search"&gt;        
  &lt;form action="/"  accept-charset="UTF-8" method="post" id="search-theme-form"&gt;
    &lt;input  name="search_theme_form" id="edit-search-theme-form-1" size="15" value="" class="form-text" /&gt;
    &lt;!-- … --&gt;
  &lt;/form&gt;
 &lt;/div&gt;


The above code is generated by the Drupal Search module. I want to add this code to the form. 

&lt;select class="search_l" onchange="selectSearch(select)"&gt;
  &lt;option value="0"&gt;whole site search&lt;/option&gt;
  &lt;option value="1"&gt;google search&lt;/option&gt;
&lt;/select&gt;


How do I do this?
I would rather implement hook_form_FORM_ID_alter() to alter the form returned by search_box(). If mymodule.module is the name of your module, then you should add the function mymodule_form_search_box_alter(&amp;$form, &amp;$form_state). You need also to replace the form submission handler with your own.

function mymodule_form_search_box_alter(&amp;$form, &amp;$form_state) {
  $form['submit']['#weight'] = 10;

  $form['search_type'] = array(
    '#type' =&gt; 'radios', 
    '#options' =&gt; array(t('Whole site search'), t('Google search')),
    '#default_value' =&gt; 1,
    '#weight' =&gt; 5,
  );

  // Replace the search.module handler with your own.
  if (in_array('search_box_form_submit', $form['#submit'])) {
    $key = array_search('search_box_form_submit', $form['#submit']);
    unset($form['#submit'][$key]);
  }
  array_unshift($form['#submit'], 'mymodule_search_box_submit');
}


You could also show the form field containing the text to search inline with the radios you add.
The code I reported replaces the form submission handler with mymodule_search_box_submit() that must be implemented from your own module. This is the code executed from the submission handler implemented by search.module; I report it as reference.

function search_box_form_submit($form, &amp;$form_state) {
  // The search form relies on control of the redirect destination for its
  // functionality, so we override any static destination set in the request,
  // for example by drupal_access_denied() or drupal_not_found()
  // (see http://drupal.org/node/292565).
  if (isset($_REQUEST['destination'])) {
    unset($_REQUEST['destination']);
  }
  if (isset($_REQUEST['edit']['destination'])) {
    unset($_REQUEST['edit']['destination']);
  }

  $form_id = $form['form_id']['#value'];
  $form_state['redirect'] = 'search/node/' . trim($form_state['values'][$form_id]);
}


As reference, I report here the code of the search.module function that builds the search box form.

function search_box(&amp;$form_state, $form_id) {
  $form[$form_id] = array(
    '#title' =&gt; t('Search this site'), 
    '#type' =&gt; 'textfield', 
    '#size' =&gt; 15, 
    '#default_value' =&gt; '', 
    '#attributes' =&gt; array('title' =&gt; t('Enter the terms you wish to search for.')),
  );
  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Search'),
  );
  $form['#submit'][] = 'search_box_form_submit';

  return $form;
}