Ooops... there was a small error in what I posted previously, It's fixed here.
Brad... it did indeed print the correct variable when I tested with the Print_r()... so I assume that capturing the sub is not the problem.
When I reviewed my Live HTTP headers log it appears that the PHP code within which this is embedded (and which does the sorting and sifting) is doing some other things to mess this up.
It appears that before it forwards to this url we've been working on, it is refreshing the page on itself, but dropping the sub=???? variable in the process and that's why it's not populating.
Here is the entire code. Perhaps you can figure out how I can tweak it to keep the sub= variable even after the refresh???
<?php
$magic_number = 1234
$seedvar=$_GET[sub];
$cpa_offer_url = "http://www.new-page.com?sub=$seedvar";
if (isset($GET['mn']) && $GET['mn']==$magic_number){
echo '<html><head></head><body><form action="' . 'http://'.$SERVER['HTTP_HOST'].$SERVER['PHP_SELF'] . '" method="post" id="form1">
<input type="hidden" name="mn" value="' . $magic_number . '" /></form>
<script language="JavaScript">
document.getElementById(\'form1\').submit();</script></body></html>';
return true;
exit();
}
if ($_POST['mn']==$magic_number){
echo '<html><head></head><body><form action="' . 'http://'.$SERVER['HTTP_HOST'].$SERVER['PHP_SELF'] . '" method="post" id="form1">
<input type="hidden" name="mn" value="' . $magic_number . $magic_number . '" /></form>
<script language="JavaScript">
document.getElementById(\'form1\').submit();</script></body></html>';
return true;
exit();
}
$dom = preg_replace( "/www./", "", $SERVER[ 'HTTP_HOST' ] ) ;
$ref= $SERVER['HTTP_REFERER'];
if (((strpos($ref, $dom)!=FALSE) || (trim($ref)=="" ) ) && ($_POST['mn']==$magic_number.$magic_number)){
header( 'Location: ' . $cpa_offer_url);
exit();
}
?>
Thanks again for all your help!
Peter