5

I would like to know how I can include additional URL parameters to a given link? ie: 'news?pid=3'

<?php
print $path='news?pid=3';
?>

This returns page not found error as the '?' is getting printed as %3F.

12

If you are using l(), you would do something like this to create news?pid=3.

l('Link Text', 'news', array('query' => array('pid' => '3')));

If you have other query parameters, you can add them in like this:

l('Link Text', 'news', array('query' => array('pid' => '3', 'foo' => 'bar')));

and that would create news?pid=3&foo=bar.

More information on l() here and url() here.

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.