Welcome Guest, Not a member yet? Register   Sign In
Help for begginier... Can't figure out problem.
#1

[eluser]dkindler[/eluser]
Hi. Everytime I run my website, I get the following error:
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Submit::$post_model

Filename: controllers/submit.php

Line Number: 9

I can't figure out what I'm doing wrong... I've been trying to figure it out for a while.

Here is my "submit" controller, which is what is executed when the form is submitted:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Submit extends CI_Controller {
function index() {
  $this->load->model('Post_model');
  $class_name = $this->input->post('class_name');
  $title = $this->input->post('title');
  $content = $this->input->post('content');
  
  $this->post_model->new_entry($title, $class_name, $content);
}  
}
?>


here is my "post" model:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Post_model extends CI_Model {
function __construct() {
        parent::__construct();
        $this->load->database();
}

function new_entry($title, $class_name, $content){
  $data = array('entry_name' => $title, "entry_class" => $class_name, "entry_body" => $content);
  if ($this->db->insert("entry", $data)) {
   echo "DB update successful (post_model.php)";
  } else {
   echo "DB update unsuccessful";
  }
}


}
?>


Does anyone see anything off? Thanks.
#2

[eluser]NikosV[/eluser]
try changing
Code:
$this->load->model('Post_model');


with
Code:
$this->load->model('post_model');
#3

[eluser]dkindler[/eluser]
yup. That worked. Thank you!




Theme © iAndrew 2016 - Forum software by © MyBB