Tuesday, August 23, 2011

How will you add the query string in url using l() function?

If you want to use the l() function and provide the destination:

('Login first','user/login', array(
'query' => array(
'destination' => 'node/'. $node->nid
)
)
);
?>

The above code will provide you with an anchor tag with the href pointed to user/login?destination=node/NID

This is only useful if you are linking to a page that consist of a form, and you want the user to be redirected to another page after submitting the form.


Ref: http://api.drupal.org/api/drupal/includes--common.inc/function/l/6

2 comments:

  1. Thank you so much..it works for me

    ReplyDelete
  2. What's up Dear, are you in fact visiting this web page daily, if so after that you will absolutely obtain fastidious knowledge.

    ReplyDelete