[eluser]elmne[/eluser]
I have the following problem
I created a model class like this
Code:
function Customertype()
{
// Call the Model constructor
parent::Model();
}
function add_customertype()
{
$this->customer_type = $_POST['customer_type'];
$this->db->insert('entries', $this);
}
}
I then created a controller class like this
Code:
<?php
class Customertype extends Controller {
function index()
{
echo 'Hello World!';
}
function customertype_add()
{
$this->load->view('admin/customertype_add');
}
function customertype_add_process()
{
$this->load->model('Customertype','',TRUE); // TRUE autoconnects model to database
$this->Customertype->add_customertype();
$this->load->view('admin/customertype_added');
}
}
?>
I then created a view class like this
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="customertype_add_process">
<p> </p>
<p>Customer Type:
<input type="text" name="customer_type" />
</p>
<p>
<input type="submit" name="submit" value="submit" />
</p>
</form>
</body>
</html>
But when the view is displayed and i click "submit", i get the following error
Quote:class Customertype extends Model { var $customer_type_id = ''; var $customer_type = ''; function Customertype() { // Call the Model constructor parent::Model(); } function add_customertype() { $this->customer_type = $_POST['customer_type']; $this->db->insert('entries', $this); } }
Fatal error: Call to undefined method Customertype::_assign_libraries() in C:\xxxxx\xxxxx\www\xxxx\system\libraries\Loader.php on line 185
Can someone please advice on the cause for the failure?