passing an object using session var

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Why am I not able to access the obj name field in script 2?

thanks in advance,

--script1---

<?php

include("TestClass.php");

session_start();
session_register('obj');

ob_start();

$obj = new TestClass();

$obj->setName('MyName');
$obj->display();        // outputs 'MyName'

header("Location:
http://localhost/~lr/webProj/photoAlbum2/sessionReceiveObj.php";);  //
re-direct to script2

ob_flush();

?>

---script 2----

<?php

include("TestClass.php");

session_start();

$newObj = $HTTP_SESSION_VARS['obj'];

$newObj->display();       // no output, meaning no data?

$newObj->setName('Michael');
$newObj->display();      // outputs 'Michael' using obj methods

?>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux