Hi,
I have a trouble with my script. Everytime I execute index.php, and call add_schedule, always appear message:
Fatal error: Call to a member function add_schedule_form() on a non-object in index.php on line 19.
I have try to fix by changing the syntax on line 19 (index.php) but it just was the same.
Can anybody help me to solve this problem? My programming is not so good, but I like programming.
I am trying to develop a reservation system for my final thesis.
Thankyou.
// file: system_class.php
<?php
class system_class {
var $mysql;
var $err_msg;
var $message;
function system_class()
{ // variable for error message
global $text;
$this->mysql=new mysql_manager('');
$this->err_msg=$text;}
function add_schedule_form() {
$form_template=file_get_contents('tpl/add_schedule.tpl.php');
$form_template=str_replace('msg',$this->message,$form_template);
$output=$form_template;
return $output;
}
}
?>
// file: index.php
<?php
ob_start() ;
session_start();
$d = dirname(__FILE__);
include $d.'/syst/system_class.php';
$action=$_GET['action'];
?>
<html><head></head><body>
<?php
function index() {
print(“<a href=\”index.php?action=add_schedule\”>add schedule</a>”);
}
function add_schedule() {
global $login;
echo $login->add_schedule_form();
}
switch ($action) {
case "add_schedule": add_schedule(); break;
//load the default function.
Default: index(); Break;
}
ob_end_flush();
?>
</body></html>