I am new to Drupal and so please bear with me if this is so obvious to you.

I am using Drupal 6.20.

I have a form submit. At the end of, the form should redirect to:

$form_state['redirect'] = 'user/4/bags?bagid=17';

However, Drupal redirects it to

user/4/bags%3Fbagid%3D17

Please note that Drupal encodes the url, which, in my case, results in a non-existant page.

How can I prevent Drupal from encoding my url?

All the best.

Comments

Drupalsky’s picture

Solved. Use the following approach:

$form_state['redirect'] = array('path', 'var1=value1', 'var2=value2', etc...);

bkosborne’s picture

The proper way to do this is:

$form_state['redirect'] = array('path', array('query' => array('var1' => $val1, 'var2' => $val2)));

The second array is passed as the options has to url().

See https://api.drupal.org/comment/16079#comment-16079 and https://api.drupal.org/api/drupal/includes!common.inc/function/url/7