Drupal – Redirect after Form Submission @ 3

When you trying to set the redirection as mentioned in
Drupal – Redirect after Form Submission @ 2

Drupal will automatically encoded the path stored in $form_state[‘redirect’]. For example:

$form_state['redirect'] = 'user/4/bags?bagid=17';
// the output path will be user/4/bags%3Fbagid%3D17


 

To avoid the encoding problem, set the $form_state[‘redirect’] as follow.

$form_state['redirect'] = array('user/4/bags', 'bagid=17');

 

You can add more query parameters.

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

 

Done =)

Reference: Drupal Forum – How can I prevent Drupal from encoding form redirect URL?

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.