0

i used this code to redirect page to another

$path=$_SERVER['QUERY_STRING'];
$new_path= 'http://localhost/mysite/print/194?0=' . $path;
drupal_goto($new_path);

but when requesting that page this error show up:

enter image description here

and the url in the address bar is:
http://localhost/mysite/print/194?0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=0=f1=All&f2[value][year]=&f2[value][month]=
but when i print the $new_path using drupal_set_message the url looks like correct one
Can you help me to solved it? thanks.

1 Answer 1

1

The biggest issue is that the query string should be passed in separate from the base URL itself, eg, it should be part of the $options array argument to drupal_goto(). Otherwise, as you've noticed, drupal_goto() doubles up a lot of times. If you fix that, I am fairly confident that you will get it to work.

Check out http://api.drupal.org/api/drupal/includes!common.inc/function/drupal_goto/7 and http://api.drupal.org/api/drupal/includes%21common.inc/function/url/7 for more information on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.