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)), '', '&');?>">link text</a>
Comments
Post a Comment