Hello!
I have just started to use classesin php, I did this because I wanted my webbapplikation to work more like a ordinary software.
Now im trying to figure how I should make the variables keep their values from page to page,
Ive read on php.net that I can use session_register() for this, and that I can save a whole class in with this. But how do I "extract" it from the session afterwards?
for example I got this class:
PHP Code:
class test {
var $test1;
var $test2;
function write() {
$this->test1 += 1;
$this->test2 += 1;
echo "$this->test1 and $this->test2";
}
}
I call for the function write
$this->write();
and then I call for it once again but later on another page
Now I want it to output "2 and 2" not "1 and 1"
I dont know more how I can explain it, can someone help me on this, or show an example how you save the class in a session and can use its methods on other pages (I know I have to include the class on all pages) with the values left.
Best Regards