Re: how can i pass a value to an included file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In message <805874.29355.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, Reji Jayan
<for_rejijayan@xxxxxxxxxxx> writes
>
>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";

You don't need to pass the value.
include "abc.php"
is sufficient.

If abc.php contains the function doit(), then in the main file, just
call doit($myvariable) as though it were in the main file.

If abc.php has code which is not in a function, it will be able to "see"
the variables in the main file.

Think of it like this. Imagine that you take abc.php, and cut and paste
it into your main file, as you would in Word, or an editor.  That is the
way that it behaves. 

-- 
Pete Clark

Sunny Andalucia
http://hotcosta.com/Andalucia.Spain

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux