that assumes that you have RegisterGlobals turned on -- which used to be the default for php, however, most hosting companies turn it off.
If you're going to use $affcode, do something like:
incoming link:
http://domain.com/page.php?affcode=asdf
At the top of the page:
<?php $affcode=$_REQUEST['affcode'];?>
then, in each of your links
<a href="page2.php?<?php echo $affcode;?>">page 2</a>