Form submission not saved when using a dynamic redirect
A form submission handler, as well a form validation handler or a hook to alter a form, should never call drupal_goto() since it outputs a HTTP header and interrupts what Drupal is doing.
The correct way to redirect a form from a form submission handler is setting $form_state['redirect'] in Drupal 7, or calling $form_state-&gt;setRedirect() in Drupal 8. The alternative for Drupal 8 is calling $form_state-&gt;setRedirectUrl().
For Drupal 7, the following code would redirect the users to node/123?foo=bar#baz.
$form_state['redirect'] = array(
  'node/123',
  array(
    'query' =&gt; array(
      'foo' =&gt; 'bar',
    ),
    'fragment' =&gt; 'baz',
  ),
);