Add to Favorites

shortcut href link different query param

Ever wanted to have an anchor link back to the same page but just change a query parameter in the url? Using php to discover the full url and echoing that before your query param may be too tedious?

There is a simple way to link back to the same page but with a different query param, say you are on article.php and you want to use an anchor to point the user to article.php?article_id=2. In the anchor href you only need to put "?article_id=2". This can come in handy to shorten your code a little, get rid of some extra output.

Comments

Be the first to leave a comment on this post.

Leave a comment

To leave a comment, please log in / sign up