Hello!
I try to use PHP session function, and it doesn't work properly. :-(
I want to pass a whole object from site A to site B to minimize Database
connections.
I don't use GLOBALS = ON. My param GLOBALS is set to OFF and has be be
keept off!
Well. I want to pass a complete object of class article from website A
to website B. A daily problem, I think! But it doesn't work!
Here is my Code:
-------------------------------------------------
class article
{
var $titel;
var $id;
var $verkaufsart;
var $mehrwertsteuerAusweisbar;
var $preisart;
var $verfügbarAb;
var $angebotspreis;
var $hinweise;
var $beschreibung;
function setTitel($titel) {
$this->titel = $titel;
}
function getTitel() {
return $this->titel;
}
function setId($id) {
$this->id = $id;
}
function getId() {
return $this->id;
}
}
-------------------------------------------------
// site A
<?php
include_once 'article.php';
session_start();
$art = new article();
$art2 = new article();
session_register("art");
session_register("art2");
$art->setTitel("Test");
$art->setId("15");
$art2->setTitel("Test2");
$art2->setId("16");
print $art->getId()." ".$art->getTitel();
print $art2->getId()." ".$art2->getTitel();
print "<a href=\"step2.php\">NEXT</a>";
?>
-------------------------------------------------
// site B
<?php
include_once 'article.php';
session_start();
if (!is_object($art)) $art = new article();
if (!is_object($art2)) $art2 = new article();
print $art->getId()." ".$art->getTitel();
print $art2->getId()." ".$art2->getTitel();
.....
-------------------------------------------------
By the way, when I print out the variable $_SESSION, I can see the
content of the object, but I dont have access:
Array ( [art] => article Object ( [titel] => Test [id] => 15
[verkaufsart] => [mehrwertsteuerAusweisbar] => [preisart] =>
[verfügbarAb] => [angebotspreis] => [hinweise] => [beschreibung] => )
[art2] => article Object ( [titel] => Test2 [id] => 16 [verkaufsart] =>
[mehrwertsteuerAusweisbar] => [preisart] => [verfügbarAb] =>
[angebotspreis] => [hinweise] => [beschreibung] => ) )
How is it possible, to receive the complete object via a php session on
the next site??
I hope you can help me!?
thanks in advance,
Lars