Welcome Guest, Not a member yet? Register   Sign In
set flashdata not working.
#1

[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 Big Grin

Thanks alot for any assistance.
#2

[eluser]theprodigy[/eluser]
can you show me the code in your template/container view, please.
#3

[eluser]malcomhfc[/eluser]
I restarted my pc this morning just tried an hour or so ago and it is working. I never made any changes.

Can restarting apache, php, mysql affect it?
---

the code in the view is just calls to other views:
Code:
$this->load->view('template/header');
$this->load->view($page);




Theme © iAndrew 2016 - Forum software by © MyBB