It was my understanding that $GLOBALS was a super global and enabled a scope to extend across all pages. I'm a noob to PHP and I have been trying to pass a value from one page to another like so:
A.php - reads
$GLOBALS['A'] = 'Passed A';
echo 'Main says:'.$GLOBALS['A'].'<br />';
disp();
function disp(){
echo 'Function says:'.$GLOBALS['A'].'<br />';
}
b.php reads
<?php
echo 'B says:'.$GLOBALS['A'].'<br />';
$code = disp();
function disp(){
echo 'Function in B says:'.$GLOBALS['A'].'<br />';
}
?>
When a.php is called I get Main says:Passed A Function says:Passed A
when it chains to b.php I get Notice: Undefined index: A in (omitted path) \b.php on line 3 B says:
Notice: Undefined index: A in (omitted path) \b.php on line 8 Function in B says
Am I correct in saying this should work? If not is there a way to send a variable from one page to the next without including them in the same file? Any help greatly appreciated.