I am having a problem passing variables to included files what I am doing wrong:
I have greated four files:
\test\filea.php
\test\fileb.php
\test\filec.php
\test\data\filec.php
\test\data\filedata.php
I can pass data read from \test\data\filedata.php to \test\filec.php but not to \test\data\filec.php here follows the files (filec.php is the same in both cases just in different places):
<?php
#File A
global $a, $b, $c;
include './data/filedata.php';
$d = $a . $b . '/fileb.php';
echo "<br>File A";
echo "<br> Value A: $a";
echo "<br> Value B: $b";
echo "<br> Value C: $c";
echo "<br> Value D: $d";
echo "<br><br><b>Include fileb from File A local</b>";
include ('./fileb.php');
$d = $a . $b . $c . '/filec.php';
echo "<br><br><b>Include filec from File A @ $d</b>";
include ($d);
?>
<?php
#File B
global $a, $b, $c;
$d= $a . $b . $c . '/filec.php';
echo "<br><br>File B";
echo "<br> Value A: $a";
echo "<br> Value B: $b";
echo "<br> Value C: $c";
echo "<br> Value D: $d";
echo "<br><br><b>Include filec from File B local</b>";
include ('./filec.php');
echo "<br><br><b>Include filec from File B @ $d</b>";
include ($d);
?>
<?php
#File C
global $a, $b, $c, $d ;
echo "<br><br>File C";
echo "<br> Value A: $a";
echo "<br> Value B: $b";
echo "<br> Value C: $c";
echo "<br> Value D: $d";
?>
<?php
#File C
global $a, $b, $c;
$a="http://www.ourdomain.com";
$b="/test";
$c="/data";
?>
The result are: