I've read through many, many threads on this and still can't wrap my head around it.
Here's my basic issue:
header.php
includes a file called navigation.php
. Within navigation.php
, $previous
and $next
are defined. Using echo statements I have verified they have values.
Next, header.php
includes a file called backnext.php
. I need backnext.php
to know the values of $previous
and $next
. If I declare them as global
at the top of backnext.php
, I don't get errors, but echo
statements show they are empty. If I don't, I get an undefined variable
error.
Where exactly do I need to declare them as global
to have backnext.php
be able to read their values correctly?
None of these files are using functions or classes.