Hello
Estimating the probability of experiencing this problem in the beginning of PHP coding there might be a lot answers out there, please don't get angry because of the beginner level this question comes from [a DB search didn't get me any satisfying results]. Well, here we go.
PAGE 1:
session_start();
include("vehicle.inc");
$motorcycle = new Vehicle;
session_register("motorcycle");
<a href="page2.php">Link to page2</a>
PAGE 2:
session_start();
include("vehicle.inc");
$motorcycle->go(55);
VEHICLE.INC:
class Vehicle {
var $model;
var $miles_per_hour;
function go($speed) {
$this->miles_per_hour = $speed;
print "<BR>The $this->model is going $this->miles_per_hour m.p.h.<BR>";
}
}
When clicking from page 1 to page 2 an error message with this content appears:
###
Fatal error: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition vehicle of the object you are trying to operate on was loaded before the session was started
###
And yes I tried some variants of including the vehicle before/after the registersess(), did that on page 1 and page 2.
Thanks in advance for help.