[eluser]rvent[/eluser]
The way i understand it is that a Controller has all the processing and validation etc, and the model should contain all the insert, updates, delete, etc that affect the DB. (technically according to the guide)
i have this controller
Code:
<?php
class Authorsc extends Controller {
function Authorsc
{
parent::Controller();
$this->load->database('default');
$this->load->model('Authorsm');
}
function createAuthor()
{
}
}
?>
And i have this model:
Code:
<?php
class Authorsm extends Model {
var $Author = '';
function Authorsm()
{
parent::Model();
}
function insertAuthor()
{
$this->Author = $_POST['Author'];
$this->db->insert('MessageAuthor', $this);
}
function showAuthors()
{
$authors = $this->db->get('MessageAuthor');
return $authors->result();
}
}
?>
So in order to get a form and enter the data i need i would have to have a view loaded by the controller and that contains something like this:
example view:
Code:
<?=form_open('MODEL/FUNCTION');?>
<?=form_hidden('author_id', $this->uri->segment(3));?>
????
The video tutorial says to use <?=form_open('CONTROLLER/FUNCTION');?>, but i want to be able to get the data from the form into the controller, do any validation or anything else i want and then give it to the model so that it can be inserted into the database...
Can someone give me insites or any ideas...?
Thanks