I am trying to check for a php variable in each of my template in order to assign it a different styling but the value seems to disappear, can you please help, I already spent hours trying to figure this out. I know there is something small I'm missing.
So here is everything:
I have a page a which links to b and pass a value in the URI as www.b.com/?value=h
now the b file receive the value and change the global variable's value to the one passed in the URI, then redirect back to the page.
This is the code in my b file:
$server = $_SERVER["REQUEST_URI"];
$valuePos = stripos($server, "=");
$nodes = substr($server, ($valuePos + 1)); $endPos = stripos($server, "e"); $gender = substr($server, ($valuePos + 1), ($endPos));
$valuePos = stripos($nodes, "-");
$redirecturl = substr($nodes, ($valuePos + 1));
header( 'Location: '.$redirecturl );
$gender is the global variable that I have declared in function.php, I have set its default value to neutral.
Now when I try to access $gender from another template it just displays the default value (neutral). Please help