How to allow customers to enter a referral id (affiliate id) of an affiliate in a page

Some merchants prefer to allow the customers to enter in the merchant's website to enter the Referral Id of the affiliate who referred them to the page  to a simple input field in case they did not use any affiliate link to come to the site.
This can be achieved by combination of:
- simple form with 1 input field
- simple php code that will add the affiliate id parameter to the click tracking code once the form is submitted
 
A complete sample code is below:
 
 
<html>
<body>
<!-- This is the form code -->    
<form action="" method="post">
Referral ID: <input type="text" id="referralid" name="referralid" value="">
<input type="submit" value="submit">
</form>

<!-- This is the click tracking code -->
<script type="text/javascript"><!--
document.write(unescape("%3Cscript id='pap_x2s6df8d' src='" + (("https:" == document.location.protocol) ? "https://" : "https://") + 
"URL_TO_PostAffiliatePro/scripts/trackjs.js' type='text/javascript'%3E%3C/script%3E"));//-->
</script>
<script type="text/javascript"><!--
PostAffTracker.setAccountId('default1');
try {
    <?php 
    if (isset($_POST['referralid']) && !empty($_POST['referralid'])){
        //if the form was submitted and there was some value in the field
        //then let's add it as affiliate id parameter to the click tracking code
        echo "var AffiliateID='".$_POST['referralid']."';";
        }
    ?>    
    PostAffTracker.track();
} catch (err) { }
//-->
</script>
</body>
</html>
 
Do not forget to replace URL_TO_PostAffiliatePro with the real URL address leading to your installation of Post Affiliate Pro (network) without protocol (without https:// or https://)
 
That's it.