I wanted to try out an example you can find here: http://php.net/manual/en/function.include.php,
but I can’t seem to be able to make it work.
In a first file, index1.php, I put this:
<?php
$color = 'green';
$fruit = 'apple';
?>
In the second file,index2.php, I put this:
<?php
include("http://www.domain.com/mypathtothefile/index2.php");
echo "A $color $fruit";
?>
It should echo ‘A green apple’, but it echos nothing.
The path is correct though, since when I put the echo part in the first file (index1.php), then it does echo ‘A geen apple’, both in index1.php as index2.php.
Hope someone can help.
Thanks in advance!
Shouldn’t it just be:
Edit: corrected to reflect file names.