Incomplete class obj when setting object as session instance
Posted: Sun May 07, 2006 8:16 am
feyd | Please use
This class is written in a file called class.inc and i use it in a page called test.php like so:
Then i tried to print the object on another page, called it default.php
the problem is it doesnt print, it prints only if i copy and paste the code in the default.php page. I already wrote a function _autoload to load it, but it doesnt help, tried changing the extension of the files to class.cart.php and to the rest, it doesnt help and it doesnt print. ONLY PRINTS WHEN I COPY AND PASTE THE CODE INTO THE SAME PAGE!!!!!!! CAN ANYONE PLEASE HELP
i am desperate, got stuck somewhere i shouldnt be..........thznk
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I wrote a code something like thisCode: Select all
class cart
{
var $test;
function cart
{
$this->test = "This is a session object variable";
}
}Code: Select all
require_once "cart.inc";
$obj = new cart;
session_register("obj");Code: Select all
require_once "cart.inc";
echo $obj->test;feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]