Hi guys,
Im trying to use a $GLOBALS variable as a way to access the current value of a variable from 1 file to another.
The 2 files involved are:
- menu2_sandbox_example.php
- geshi_code_iframe.php
I have defined a $GLOBALS variable in menu2_sandbox_example, and Im trying to get this current value as set in menu2_sandbox_example, available in geshi_code_iframe.php
So far, if I echo out the value in geshi_code_iframe.php, it returns nothing, so Im calling on your kind folk to please see where Im going wrong :>)
Here is the code in menu2_sandbox_example.php where im setting it:
==========================
==========
==========
======= menu2_sandbox_example.php
$GLOBALS['current_sandbox_
page'] = basename($_SERVER['PHP_SEL
F']);
$GLOBALS['current_sandbox_
page'] = explode('_',$GLOBALS['curr
ent_sandbo
x_page']);
$current_sandbox_page[2] = substr($current_sandbox_pa
ge[2],0,-4
);
array_push($GLOBALS['curre
nt_sandbox
_page'],"o
utputifram
e.php");
print_r($GLOBALS['current_
sandbox_pa
ge']);
$GLOBALS['current_sandbox_
page'] = implode('_',$GLOBALS['curr
ent_sandbo
x_page']);
<iframe name="outputIframe" width="100%" height="100%" src="sandbox/<?php echo $GLOBALS['current_sandbox_
page'] ?>"></iframe>
--------------------------
---------
When i echo the $GLOBALS above, it gives me the correct value ----> I just want access to this same value in geshi_code_iframe.php
Here is my geshi_code_iframe.php call to it :>)=======================
========
echo "the value of globals sandbox is: " . $GLOBALS['current_sandbox_
page'];
include ("../includes/geshi/geshi.
php");
// Define what file you want to look at:
$file_name = 'menu2_sandbox_example_out
putiframe.
php';
------ Guys, in the above, when i echo $GLOBALS['current_sandbox_
page'], no value is returned.
This is where my problem is.
Any help greatly appreciated :>)
Just wondering too guys if there is a better way for me to do this, a cleaner way than to use the globals keyword.
Start Free Trial