Hey guys I'm a php noob who's inherited this site and can't figure out how to check if the url has a variable in it, then set that variable as something else (sorry if the jargon's wrong)
PHP Code:
function adExtNo($defaultExt = '1004'){
if(isset($_COOKIE[__FSCOOKIE_PRINT_EXT])){ //Detect custom print media ad ext number
$adCookie = $_COOKIE[__FSCOOKIE_PRINT_EXT];
return $adCookie;
}else{ //Else detect ppc ad ext number
if(isset($_COOKIE[__FSCOOKIE_PPC_EXT])){
$adCookie = $_COOKIE[__FSCOOKIE_PPC_EXT];
return $adCookie;
}else{ //Else detect ppc ad ext number in url
if(isset($_GET[ppc_ext])){
$adCookie = $_GET[ppc_ext];
return $adCookie;
}else{ //Else just set ext number to web default
return $defaultExt;
}
}
}
Currently the code checks for a variable in a cookie then sets $adCookie as that value (I believe). If there's no cookie value then I want it to get the value from the tagged url, and if the url isn't tagged then defaultExt.
I've been trying to add the second }else{ statement to detect a variable in the URL (i.e. url.com/?ppc_ext=1234) then if it exists set $adCookie to that value, else return $defaultExt.
does anyone know how to do this?
Thanks for any help.