CodeIgniter Forums
Return Error from Validate - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Return Error from Validate (/showthread.php?tid=2975)



Return Error from Validate - El Forum - 09-03-2007

[eluser]iniweb[/eluser]
Code:

Code:
function News_Add()
        {
                $data = array(
                        'error'  => $this->validation->error_string
                );

                $content = $this->parser->parse('Backoffice/News_Add.tpl', $data);

                $data = array(
                        'content'  => $content,
                        'sysblock'  => SysBlock::Index()
                );

                $this->parser->parse('Backoffice/main.tpl', $data);
        }

        function News_Add_Check()
        {
                $this->load->model('NewsModel');

                $rules['author'] = "trim|required";

                $this->validation->set_rules($rules);

                if ($this->validation->run() == FALSE) {
                        redirect('/index.php?c=Backoffice&m=News_Add', 'refresh');
                } else {
                        $this->NewsModel->Insert_News();

                        redirect('/index.php?c=Backoffice&m=News_List', 'refresh');
                }
        }

Now error returned on function News_add_check, but need return error on function News_Add(). How?