Welcome Guest, Not a member yet? Register   Sign In
help finishing the CI tutorial
#1

[eluser]Unknown[/eluser]
hi guys
i'm kind of new to CI. i've done the news blog tutorial, and got to the end of it, but the input form does not enter data in to the database. the connection to the database is ok - and when i take the validation part out of the create function in news controller - it passes zero's to the database.
i believe its not getting in to the else part of the function - since after submitting the form it stays on the same page.
any ideas where is the problem ?

the create function looks like this:


public function create()
{
$this->load->helper('form');
$this->load->library('form_validation');

$data['title'] = 'Create a news item';

$this->form_validation->set_rules('title', 'Title', 'required');
$this->form_validation->set_rules('text', 'text', 'required');

if ($this->form_validation->run() === FALSE)
{
$this->load->view('templates/header', $data);
$this->load->view('news/create');
$this->load->view('templates/footer');

}
else
{
$this->news_model->set_news();
$this->load->view('news/success');
}
}
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

I suspect the problem is with your view, or your set_news() model method. Please post both of those.




Theme © iAndrew 2016 - Forum software by © MyBB