add parameter to all URLs

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am trying to make something similar to  For example:

If you search for a city, say Raleigh, NC, it will find it for you,
but then all other URLs on the page will have the location parameter
attached.  For example, say "city=raleigh"  So, if you go back to the
home page, or any other page on the site, that will still be attached to
the URL.  Is there any easy way to do that?  I know PHP has a way to
automatically attach a session ID to every URL.

Is there a way I can attach a parameter of my own choosing automatically?

I don't think cookies will work in this situation.  The problem with
cookies is that there is only one cookie with one location in it, where
the user may have several pages open for different locations.

what do you think?

Re: add parameter to all URLs

Doug wrote:
Quoted text here. Click to load it

Just a quick solution, write a little function like so:


function appendit() {
    if(isset($_GET)) {
        $message = '?';
        foreach($_GET as $append_key => $append_val ) {
            $message .= $append_key.'='.$append_val.'&';
return $message;

$urladdon = appendit();

echo '<a href="test.php'.$urladdon.'">Test Page</a>";

Something like that should do the trick, there might be more automated
ways about, let the group know your findings.

Hope that helps,


Re: add parameter to all URLs

Quoted text here. Click to load it

Go way to do this is to turn on output buffering then attach the parameters
to every hyperlink with help from regular expression. A manual search and
replace is probably best though--and probably quicker.

Site Timeline