I've just started to learn CodeIgniter and gotten trouble with example below:
My Controller:
class Site extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
function index()
{
$this->load->view('options_view');
}
function create()
{
$data = array (
'title' => $this->load->input->post('title'),
'content' => $this->load->input->post('content')
);
$this->site_model->add_record($data);
$this->index();
}
}
My Model is:
class Site_model extends CI_Model
{
function get_records()
{
$q = $this->db->get('articles');
return $q->result();
}
function add_record($data)
{
$this->db->insert('articles',$data);
return;
}
}
My view is:
So when I click Submit button I get the error like:
Severity: Notice
Message: Undefined property: CI_Loader::$input
Filename: controllers/site.php
Line Number: 19
Any ideas will be usefull!Thanx!!
No comments:
Post a Comment