Reply to Re: Passing objects from one page to another

Your name:

Reply:


Posted by Marcin Dobrucki on 11/08/06 15:29

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();
?>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация