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.
Here is de code:
class.person.ph p
-----------------------------------
class person {
private $_name;
public function setName($name) {
$this->_name = $name;
}
public function getName() {
return $this->_name;
}
}
--------------------------------------------
person1.php // here is the object created
-------------------------------------------
require_once("c lass.person.php ");
$p = new person();
$p->setName("Jim") ;
$safep = urlencode(seria lize($p));
header("Locatio n:person2.php?d ata=".$safep);
exit;
person2.php // page where the object is transfered to
---------------------------------------------------
require_once("c lass.person.php ");
$p = unserialize(url decode($_GET['data']));
echo $p->getName();
page and pass that object to a next page but that does not work for me and i
do not understand why.
Here is de code:
class.person.ph p
-----------------------------------
class person {
private $_name;
public function setName($name) {
$this->_name = $name;
}
public function getName() {
return $this->_name;
}
}
--------------------------------------------
person1.php // here is the object created
-------------------------------------------
require_once("c lass.person.php ");
$p = new person();
$p->setName("Jim") ;
$safep = urlencode(seria lize($p));
header("Locatio n:person2.php?d ata=".$safep);
exit;
person2.php // page where the object is transfered to
---------------------------------------------------
require_once("c lass.person.php ");
$p = unserialize(url decode($_GET['data']));
echo $p->getName();
Comment