hi, I am selling products from clickbank and am using php redirects to hide my affiliate links. I am trying to insert a variable into my php redirects for the affiliate ID so that I can change it easily. for example, ID.php have the following code <?php $aff_id = 'myID'; ?> PHP: and ebook.php have this code: <?php include 'name.php'; $site = 'http://' . $aff_id . '.product.clickbank.net/'; header( 'Location: $site' ) ; ?> PHP: by changing the value of $aff_id on ID.php, I can change the affiliate link on ebook.php. the advantage of this is I can change a single ID.php to affect all php files I had. I used the code as shown above but it doesn't work. can anyone help me?
Use double quotes. Variables between single quotes won't be parsed. header( "Location: $site" ); PHP:
usually variables inside the quotes are leading to errors for new coders, better use string joining like: header( "Location: ".$site ); PHP: so you can use whatever quotes you want: header( 'Location: '.$site ); PHP: cheers
what does the die func does? I look it up at http://sg2.php.net/die and still have no clue. does it work like return()?
die() completely ends the PHP script, same as exit(), and doesn't run any line (even regular HTML output below it) afterwards return just exits a function/included file and continues the original script