hi guys. i am writing a class for registering data and i am having a problem calling functions and vars from other classes.

here's a class diagram of where everything is called-


i am in forms, and i am having difficulty getting vars from site, using my functions in postgredb and vars from user.

i can get data from form easily.


but when i try getting data from site i get an fatal saying site is not a member of form, ($this->site->var) so, how do i call data from a parent class?

solved it- used a public $p; then set $form->p = $this, and then when calling parent date - $this->p->var...

8 Years
Discussion Span
Last Post by somedude3488


class test {
var $var;
function __construct() {
$this->var = 'something';
function testing() {
echo 'This is the parent function';

class test2 {
var par;
var var2;
function __construct( &$par ) {
$this->par = $par;

$test = new test();
$test2 = new test2( $test );

$test2->par->testing() //will echo 'this is the parent class';

thats one way to do it. there are more.


if the thread is solved, please mark it as so. This way I don't waste anymore time replying to something that you already figured out.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.