Posted by Marcel on 11/08/06 15:40
"Marcin Dobrucki" <Marcin.Dobrucki@TAKETHISAWAY.nokia.com> schreef in
bericht news:lJm4h.42490$_k2.774821@news2.nokia.com...
> Marcel wrote:
>> I have a person class adn i want to derive an object of that class on one
>> page and pass that object to a next page but that does not work for me
>> and i do not understand why.
> ...
> I tried this code, and it works just fine. You didn't include the rest of
> the code, so maybe there is something there that breaks it?
>
> <?php
> class A {
> var $name;
> function A($name) {
> $this->name = $name; }
> function getName() {
> return $this->name; }
> }
>
> $a = new A("my name");
> $a_serialized = urlencode(serialize($a));
> header("Location: obj2.php?data=".$a_serialized);
> ?>
>
> and:
>
> <?php
> class A {
> var $name;
> function A($name) {
> $this->name = $name; }
> function getName() {
> return $this->name; }
> }
>
> $a = unserialize(urldecode($_GET['data']));
> echo get_class($a);
> echo "<br>";
> echo $a->getName();
> ?>
Hi Marcin,
I tried your example but i am getting the same error: Call to a member
function getName() on a non-object in
Maybe it is a php.ini issue? I do not know what can be another reason....
maybe magicquotes have to do something with this?
Do you have any ideas?
Marcel
[Back to original message]
|