you can set variables and get them using session or cookie. Also dont use short tags in php it has been deprecated. Use full php tags
To pass a variable using session you can do this:
(Not Recommended to store database config)
In file A you do this
$_SESSION['db_host'] = "XXX.XXX.XXX.XX";
In file B you call like this
$db_host = $_SESSION['db_host'];
YOu can also do through cookies (Not Recommended for sensitive data)
In file A you do this
$_COOKIE['db_host'] = "XXX.XXX.XXX.XX";
In file B you call like this
$db_host = $_COOKIE['db_host'];
You can also use GLobal variables but that is a risky.
Best way is to define variables inside a class and include the class inside your files where you need those variables.
So in File A you can set the config
<?php
class Config {
public $host = DB_HOST;
public $dbuser = DB_USER;
public $dbpass = DB_USER_PASSWORD;
public $db = DB;
}
?>
In file B
include_once("A.php");
$dbnew = new Config;
Then access the variables this way
$host = $dbnew->host;