I hope someone can help me. I've created an object which creates a connection with a database in the constructor. I want the object accesible to all my pages. How can i do it without instantiating a new object on every page?
My first page looks like this:
<?php session_destroy();
session_start();
include("createFormElement.class");
$formClass = new createFormElement(); // create object
$formClass->getPathwayCodeSelectList();
?>
second page: (I create the same object again!)
<?php session_start(); ?>
$pathCode= $pathwayList;
include("createFormElement.class");
$formClass = new createFormElement();
$formClass->getPathwayStudentSelectList($pathCode); ?>
<?php session_register("student");?> // this stores variable from form created on second page
Is there a way to pass object from first page to second??