Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Pass Objects all over my site

Posted on 2006-10-23
7
Medium Priority
?
206 Views
Last Modified: 2008-03-04
Index.php
------------

$myDoor = new door();
$myDoor->SetDoorType('single');


now, on step 2.php (or any other page)  I need $myDoor.

In this example, $myDoor->GetDoorType(); *SHOULD* return "single" no matter what page I am on.

Thanks!



0
Comment
Question by:edvinson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 2000 total points
ID: 17792593
The way to do this is to save everything in session variables.  This way for this login all the variables are saved across the pages

you can start your sessions with
session_start();
at the start of the page.

at the end of the page using $myDoor do something like

$_SESSION['myDoor'] = serialize($myDoor);

then when you want to use it again you would do

$myDoor = unserialize($_SESSION['myDoor']);

of cource checking if $_SESSION['myDoor'] exists

http://au.php.net/serialize

serialize and unserialize save the data that is in myDoor into a format that is saveable on disk - unserialize reinflates the data back into a class
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17792594
oh,

an you need to include the definition for your class before you unserialize - else it does not know how to treat the data
0
 
LVL 1

Author Comment

by:edvinson
ID: 17792639
DO I EVEN NEED TO SAY IT...

PERFECT.... THANKS!

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:edvinson
ID: 17792642
Congrats on topping the million point mark. That is quite an accomplishment.
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17792644
Thankyou very much - for the points and the encouragement - 118 days ago I thought that 1million would be impossible so now i've proved its not sembee watch out (lol)
0
 
LVL 1

Author Comment

by:edvinson
ID: 17792666
One last thing, I have an open question with you. It's the LAT LONG thing.

I will be unable to test that for a few more weeks, as I am really busy on another project. If I give you the points, can you bookmark it so we can revisit it later sometime?
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17792675
ok - email me when you want to get back onto it
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question