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:
<pre> <?php echo form_open('site/create');?> <p> <label for="title">Title:</label> <input type="text" name="title" id="title"/> </p> <p> <label for="content">Content:</label> <input type="text" name="content" id="content"/> </p> <p> <input type="submit" value="Submit"/> </p> <?php echo form_close();?> </pre> 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!!