How do I pass a variable via drupal_goto()? So I have a function having http://link/to/$id as destination link.

It works when I use &lt;a href="?q=mymodule/option/$id"&gt;Targeted&lt;/a&gt;.

But I need to change it to submit form because I need to pass more than one $id. So, I thought it was good to use drupal_goto() rather than the link option. 

drupal_goto('mymodule/option/$id');
drupal_goto('mymodule/option/'.$id);
drupal_goto('mymodule/option/', $id);


Those are not working. It always go to http://link/mymodule/option without passing $id variable. How do I do this correctly?
Assume your url is like in this example:

http://example.com/somepage?param1=val1&amp;param2=val2


In that case you can take values of param1 and param2 like so:

$param1 = $_GET['param1'];
$param2 = $_GET['param2'];


You may use this parameter for drupal_goto as

drupal_goto("path_here", array("param1" =&gt; $param1, "param2" =&gt; $param2));


For Drupal 7:

As YPCrumble says you need to use this code:

drupal_goto("path_here", array("query" =&gt; array("param1" =&gt; $param1, "param2" =&gt; $param2)));


For more details, refer to the API Documentation.