Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

calling a variable from other php file.

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

calling a variable from other php file.

Postby gesf » Sun Dec 29, 2002 5:28 am

hi guys.
Can anyone tell how can i call a variable from other php file? I making some changes in my forum and i´m making a system to send msgs by icq if the user have it. Well, but the form to send that msgs is open in a new window, but a need to send for the form of the new window, the information of the user to complete the emailform that is in the openner page index.php. how can i do? Thanks a lot
Last edited by gesf on Sun Mar 07, 2004 11:56 am, edited 1 time in total.
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby DecoRJ » Sun Dec 29, 2002 6:49 am

I didn´t understand what you exactly want to do, but... I think including this php file with the variable will resolve the problem...

For this, only do this in the beginning of your script:

include("file.php");
DecoRJ
New php-forum User
New php-forum User
 
Posts: 3
Joined: Sun Dec 29, 2002 6:38 am

Postby gesf » Sun Dec 29, 2002 7:14 am

Hunn, no... it will not work that way.
I can´t include the openner file "index". this file have so much things and i just need to pass the information of some variabels, and not the complete file. Is there some way to call some vars without calling the complete file? i don´t... specifying: first -file and second- vars.
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby DecoRJ » Sun Dec 29, 2002 7:41 pm

Yes... of course there are alternatives to you.... like saving these variables to a file (using fopen) and then getting them from there....

But I think.. the better way for you woluld be using sessions. You will register the vars that you want and then, in the next page, you will get these vars from the session
DecoRJ
New php-forum User
New php-forum User
 
Posts: 3
Joined: Sun Dec 29, 2002 6:38 am

Postby gesf » Sun Dec 29, 2002 11:34 pm

Yep...that´s the better way. I´m gonna try to do with writing in a file first...i don´t know work with sessions ! :(
Thanks DecoRJ.
C ya
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.