General Object/Sesssion questions...

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
vincefrantz
Forum Newbie
Posts: 1
Joined: Wed Sep 24, 2003 12:14 pm

General Object/Sesssion questions...

Post by vincefrantz »

I have an class I created that needs to have attributes updated on one page and then available and updateable on subsequent pages. I have read a lot about objects and sessions and am generally familiar with issues involved. But I have a basic question that I haven't been able to answer from those readings..

Once an object is created ($Obj = new className()) and the attributes are set to their initial values (via a constructor), can I update those values from within some methods and have that $Obj (and the new values) be available on later pages through sessions?

In my tests, I have been able to change the value of an attribute from outside the object ($Obj->var = 'a new value') but when I try to change it from within a method ($this->var = 'a new value') and then call it from the outside (echo $Obj->var) I get the old, initial value.

This is my first OOP project AND my first Session tracking project. I understand the logic and value behind these tactics and I want to learn, but the project does have some complex classes to accomplish the objectives. Thanks..
Post Reply