i'm trying to pass variables from userInfo.php
to flips.php
but for some reason the variables don't go through.
When i do echo "hello";
in the userInfo.php then i do see 'hello' in the website but when i do:
if (isset($variable)) {
echo "it is set!";
} else {
echo "nope!";
}
Then it returns 'nope!' even though i have set $variable
in userInfo.php
.
userInfo.php:
<?php
$variable = "hello everyone!";
echo "hello!";
flips.php:
<?php
include ('userInfo.php');
if (isset($variable)) {
echo "it is set!";
} else {
echo "nope!";
}
Website output:
hello!nope!
what am i doing wrong so flips.php
doesn't see $variable
?
Edit (the real code from my website):
flips.php:
include ('../csgodonut/application/views/steamauth/userInfo.php');
if (isset($steamprofile["personaname"])) {
echo "yes!";
} else {
echo "nope..";
}
userInfo.php:
$steamprofile['personaname'] = "Smokey";
echo "test";
Website: www.csgodonut.com (you have to login to steam in order to see the hello! nope..
)
flips.php location: csgodonut/application/views/gebruiker/home/flips.php
userInfo.php location: csgodonut/application/views/steamauth/userInfo.php
$variable
is called$steamprofile
in my code, other then that it is exactly the same – Smokey Jan 14 '18 at 22:03<?php
? seems unlikley – user8011997 Jan 14 '18 at 22:04<?php
is in my code – Smokey Jan 14 '18 at 22:05include path
anywhere? You ought to check the include path usingget_include_path()
&/or set withset_include_path()
- maybe also check inflips.php
what files have been included withvar_dump(get_included_files());
~ or try withrequire
to see any errors it may throw – Professor Abronsius Jan 14 '18 at 22:18