How can I move a variable from one script to another?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jelco
Forum Newbie
Posts: 4
Joined: Sat Jul 12, 2003 2:53 pm
Location: Kingston, Ontario, Canada

How can I move a variable from one script to another?

Post by jelco »

Hi,
I need to move or copy variables from one script to another and they need to keep the info that they hold, is there any way of doing this?

The way I have my site setup is you login and you go to one of three pages (depending on your info in the db), then you have links to all these other places. You go to one of the places and then fill out a form lets say and then I need to have a link to bring the person back to their original page (one of the three i described earlier). The only way I can think of doing this is by moving or copying variables. Any help is appriciated!
Brian
Forum Contributor
Posts: 116
Joined: Thu Apr 18, 2002 5:33 pm

A Few Solutions For You

Post by Brian »

If your user is still logged in, you could easily check your database as you do when your user first logs in. That might be the fastest and easiest thing for you to implement since you are doing it already. You could also use PHP's built-in session handling functions to keep track of as many variables as you like. If you want to avoid server overhead from database queries and session variable loading and saving, you could store some basic information in an HTTP cookie.
Brian
Forum Contributor
Posts: 116
Joined: Thu Apr 18, 2002 5:33 pm

You might also find this helpful.

Post by Brian »

jelco
Forum Newbie
Posts: 4
Joined: Sat Jul 12, 2003 2:53 pm
Location: Kingston, Ontario, Canada

Post by jelco »

I wasn't think when I posted, they come from the page to another page that only people with that info can get to so all i have to do is add a link back to the first page because people with diffrent people can't get to that page. And I'm not using a hard login script, it just scans the db for the username and password and if its there lets you in so I don't know how I could do it a diffrent way but thankz for your help!
Post Reply