Create link in PHP with Get Parameters -


i'm new php, i'm working on simple web page.

this page quite configurable different parameters. so, may called like:

www.example.com/index.php?test=1&foo=3&bar=4

now question is, idiom generating link current page 1 parameter changed?

for example, i'd change foo 5, what's easiest way generate link like:

www.example.com/index.php?test=1&foo=5&bar=4

i can loop through , manually, figured there common idiom this.

thanks ton!

array_merge() you're looking for

<a href="http://www.example.com/index.php?<?php echo http_build_query(array_merge($_get, array('foo' => 5)), '', '&amp;');?>">link text</a> 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -