Hi guys, Iam very new to drupal..

I have an issue using drupal_goto(). when Iam trying deleting a topic in a group it is leading to home page of site but should lead to that particular group from where I have deleted the topic...can I know what parameter should use there?

Its very urgent..thanks in advance.

Comments

xangelo’s picture

drupal_goto() is outlined here: http://api.drupal.org/api/function/drupal_goto/6

Basically you provide a path to be redirected to.

URL: http://www.example.com/some/path/you/want

drupal_goto('some/path/you/want') will redirect you to the URL above.

dhanesh.haridas’s picture

Use Drupal get destination

<?php
$query = drupal_get_destination();
drupal_goto('url-to-page',$query);
?>
anthony0perez’s picture

I am real new too. Can you give an example of how to retrieve from the url like a $_GET? I am lost - it looks like it is encoded when it goes to the next page... Thanks

Rajan M’s picture

If your url is like
http://example.com/somepage?param1=val1&param2=val2

then u can take values of param1 and param2 as
$param1 = $_GET['param1'];
$param2 = $_GET['param2'];

you may use this parameter for drupal_goto as
drupal_goto("path_here", array("html" => true, "query" => "param1=$param1&param2=$param2"));

gavinengel’s picture

@Rajan

Not quite correct. This is the way to pass $_GET parameters. I'll repeat your example, with a small correction in the last line:

If your url is like
http://example.com/somepage?param1=val1&param2=val2

then u can take values of param1 and param2 as
$param1 = $_GET['param1'];
$param2 = $_GET['param2'];

you may use this parameter for drupal_goto as
drupal_goto("path_here", array("param1" => $param1, "param2" => $param2));

dkiiashko’s picture

It is not correct too)).

If your url is like
http://example.com/somepage?PARAM=VALUE

drupal_goto('<front>',array('query' => array('PARAM' => 'VALUE')));
drupsforyou’s picture

drupal_goto("path_here");
Example :: drupal_goto("http://www.google.com");

gsharm’s picture

You can use this code in your module file and redirect the fetch result location.

  $query = array('category' => 'newcategory','country'=>'india');
  drupal_goto('test-url',$query);

And some easy way of redirect the location.

drupal_goto("https://drupal.org/");

Thanks.