What is the difference between using drupal_goto('$path') and header('Location: $path')?
I had an exposed filter with identifier named destination. Since drupal_goto() takes care of the destination parameter sent in URL with the following code, it was overwriting my code.

  // A destination in $_GET always overrides the function arguments.
  // We do not allow absolute URLs to be passed via $_GET, as this can be an attack vector.
  if (isset($_GET['destination']) &amp;&amp; !url_is_external($_GET['destination'])) {
    $destination = drupal_parse_url($_GET['destination']);
    $path = $destination['path'];
    $options['query'] = $destination['query'];
    $options['fragment'] = $destination['fragment'];
  }