im trying to echo the variable that has been pass into a class. I have this code below (refer below)
engine.php
<?php
define('access', TRUE); //define to true so that we can access core.php
// engine
include_once('core.php'); //include core.php
$core = new core();
j_interpreter("login"); //call j_interpreter function
function j_interpreter($key){
//switch request base on the request key
switch($key) {
case "login" :
extract($_POST);
$core->j_login($username, $password);
break;
default :
echo "default";
} //end of switch
}
?>
core.php
<?php
if(!defined('access')) :
//foreign access then dont allow!
die('Direct access not permitted');
endif;
class core{
public function ___construct(){
//macro stuff here
}
public function j_login($username, $password){
echo $username . " " . $password;
}
}
im trying to get the username and password post data that has been pass from engine.php to core.php but sadly it gives me error
Notice: Undefined variable: core in C:\wamp\www\proj\core\engine.php
Fatal error: Call to a member function j_login() on a non-object in C:\wamp\www\proj\core\engine.php
any ideas?