ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

set flashdata not working.

May 26, 2011 6:50pm

Subscribe [2]
  • #1 / May 26, 2011 6:50pm

    malcomhfc

    27 posts

    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()

    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 :D

    Thanks alot for any assistance.

  • #2 / May 27, 2011 8:11pm

    theprodigy

    653 posts

    can you show me the code in your template/container view, please.

  • #3 / May 27, 2011 8:23pm

    malcomhfc

    27 posts

    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:

    $this->load->view('template/header');
    $this->load->view($page);
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases