I have looked high and low to try and figure out how to do this. It seems to be an easy thing to do, but I am not having any luck getting all the pieces together to get it all to work; and, when I try “canned” scripts and/or cgi, they either don’t work or the scripts only supply half of the puzzle. So, does anybody have a simple straightforward way to do the following:

A customer clicks on an affiliate’s hyperlink to my site, where the URL contains variables, like so:


Once at the site, a cookie is saved on the customer’s machine, saving the variable information that is tacked onto the URL. The customer may then freely navigate the site.

The saved variables are re-inserted into the URL of the order page's hyperlink to the fulfillment center, when it is clicked, so that this information is properly passed onto the secure page of the fulfillment center servicing my site, like so:


When the customer re-visits the site, the same saved information is used again, so that my affiliates continue to get their commissions. If there is no cookie, the variables are omitted from the URL. An optional expiration would be useful.