DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

how can i pass a value to an included file

By: Manoj | 19 Sep 2008 11:08 pm

 Hello all,

i am having a doubt ...

actually im strucked here

how can i pass a value to an included file??

its like this

include "abc.php?value= $xyz";

Thanks

Comments

value=$xyz;
include "abc.php";
By: Shailesh Singh | 19 Sep 2008
include "abc.php?value= $xyz";
is also correct

value=$xyz;
include "abc.php";

is also correct
Both will work

But

No. As previously stated variables that are already set are essentially 'passed' to the
include file. HOWEVER... if you are defining a function... in the include file you may have
to do one of these:

1.
function something ()
{
global $xyz;
}

OR

2.
function something ($xyz)
{
}

OR even

3.
function something (&$xyz)
{
}

What is in $xyz and what you are doing with it will dictate which method of access to use.
By: Shailesh Singh | 19 Sep 2008

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move