I have developed a class called vehicle.
I have written the class so when a vehicle id is entered, the class queries a database for details regarding that specific vehicle only as each vehicle is unique.
All the data is retrieved on instantiating the class so that all data is present for the user. ie there will be no need to query the database unless the user is looking at another vehicle.
I have implemented methods that output the data in specific formats. Not all the data will be shown. Some of this data is regarding pictures.
So far i am able to retrieve vehicle data as required and output any/all the data but what i would to do is reload the page without having to 'reload' the vehicle data into the object.
eg
i have 3 different interfaces:standard, interior and exterior
at the moment i have got:
//viewVehicle.php?id=8029
$id = $_GET['id']; //very simplified
include('vehicle.class.php');
$vehicle = new Vehicle($id);
$vehicle->outputStandardInterface();
the above script take in a vehicle id ($id), retrieves data into class ($vehicle = new Vehicle($id)😉, and then outputs the first screen.
What i want is to run:
[/code]
$vehicle->outputInteriorInterface();
[/code]
but the only way i can think of is
//viewVehicle.php?id=8029&action=interior
$id = $_GET['id']; //very simplified
$action = $_GET['action'];
include('vehicle.class.php');
$vehicle = new Vehicle($id);
switch($action){
case 'standard' : $vehicle->outputStandardInterface(); break;
case 'interior' : $vehicle->outputInteriorInterface(); break;
default : $vehicle->outputStandardInterface(); break;
}
but as you can the class gets redefined and the database requeried everytime
I want the relevant method to be activated from a link/button so i suppose some sort of javascript is required.
i hope this illustrates my requirements/problems. I fnybody has any pointers/ideas they will be much appreciated
regards
Edward Przeniczny