Why form redirects to encoded url when having GET params? I have a simple form with 1 select and I want it after the form submit to redirect to the same URL, but with added GET params.



So in a form submit I added:

$form_state['redirect'] = url(arg(0).'/'.arg(1).'/'.arg(2), array(
  'query' =&gt; array(
      'brand' =&gt; $state['values']['brand'],
      'categ' =&gt; arg(2)
)));


Which redirects to wrong encoded url:


  /produkty/vlasy%3Fbrand%3D118%26categ%3D27




But It works well when I use drupal goto (this is not recommended):

  drupal_goto(arg(0).'/'.arg(1).'/'.arg(2), array(
      'query' =&gt; array(
          'brand' =&gt; $state['values']['brand'],
          'categ' =&gt; arg(2)
  )));



  /produkty/vlasy?brand=118&amp;categ=27




Why is it so?
You just need to adjust the param value from a string to an array for $form_state['redirect']

It is in the documentation for drupal_redirect_form


  $form_state['redirect'] determines where to redirect the user. This can be set either to a string (the path to redirect to), or an array of arguments for drupal_goto().


Example:

$form_state['redirect'] = array(
  arg(0) . '/' . arg(1) . '/' . arg(2),
  'query' =&gt; array(
        'brand' =&gt; $form_state['values']['brand'],
        'categ' =&gt; arg(2)
  )
);