[eluser]malcomhfc[/eluser]
Hi ive built a form and when submitted it runs form validation and then if sucessful then runs next if statement and then if sucessful again it sets flash data to sucess and reloads page. However on reload there is nothing there. Can anyone assist me in troubleshooting it please? I have the proper code in my view and have also tried keep_flashdata()
Code:
function Manage()
{
$this->form_validation->set_rules('doDomain', 'domain', 'trim|required|prep_url');
$this->form_validation->set_rules('doUser', 'username', 'trim|required');
if($this->form_validation->run())
{
// the form has been sucessful
if($this->domain_m->addDomain(array('doDomain' => $this->input->post('doDomain'), 'doUser' => $this->input->post('doUser'))))
{
$this->session->set_flashdata('sucess', 'You have added a website to your account profile sucessfully.');
redirect('account/manage');
} //building the view
}
$data = array('title' => 'RobbieK | Add a website');
$data['page'] = 'managedomain/domainadd'; // pass the actual view to use as a parameter
$this->load->view('template/container',$data);
}
Can you see my error please? Also since im learning php and codeigniter, is there a cleaner way of doing the above code? It looks a mess too me
Thanks alot for any assistance.