Using 'drupal_get_destination()' with a l() link



Hi, I'm trying to create a login link that returns the user to their previous page once logged in. The link looks something like:

"l(t('login'), 'user/login?'.drupal_get_destination() ..."

Which correctly shows as "user/login?destination=recipe" in the source, but turns into
"user/login%3Fdestination%3Drecipe" 

once on the login page, and doesn't work.

What am I doing wrong?



Use this. The key is in using $base_url with the link.

global $base_url;
  $linkform = array(
    '#type' => 'markup',
    '#value' => l("Click here to ship to International", $base_url."/set_country/840?".drupal_get_destination()),
 );