Forum Moderators: coopster

Message Too Old, No Replies

passing data to included file

         

kumarsena

2:26 pm on Nov 12, 2004 (gmt 0)

10+ Year Member



just wondering,

is it possible to include a file using include() and at teh same time pass some variable or something to that file? say it contains a fucntion and the function needs an argument or whatever to work..? can i use scriptname.php?var=value?

k

Birdman

2:39 pm on Nov 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can create the variable in the current script and it will be available in the included script.

kumarsena

3:25 pm on Nov 12, 2004 (gmt 0)

10+ Year Member



hmmm yea,, didnt think of that...tnx

Slade

4:09 pm on Nov 12, 2004 (gmt 0)

10+ Year Member



If you wrap the whole of the file you want to include into a function, you can include_once/require_once it, and then just call the function varying the parameters as necessary.