Question
I want to make $associate_name
and $app_key
global variable so I can access them on any page I want. Below is the cod
Put those variables you want as session or cookie data. Otherwise, you would have to resort to the global
keyword, which is a very bad way of doing things in modern PHP applications.
It would be like this (for session):
$_SESSION["myvar"] = <value>;
It's a bit more complicated with cookies, but this should get you going ;)
variables/constants
in a separate file may be constants.php
Include that constants.php
wherever you want to access that variable.Sessions are your choice in case the value is modified. Otherwise (the value is constant from your configuration and not from user's modification, go for Constants