Welcome Guest, Not a member yet? Register   Sign In
Flashdata redirect
#1

[eluser]Kemik[/eluser]
Hi guys,

I'm trying to save a flashdata message once the user fills out a form to create a client and have it display when the user is redirected.

clients/create controller
Code:
function create()
    {
        /* Loaders */
        $this->load->helper('form');
        $this->load->library('form_validation');

        if ($this->form_validation->run() == FALSE)
        {
            /* Load views */
            $this->load->view('header');
            $this->load->view('clients_create');
            $this->load->view('footer');
            
        } else {
            
            $client = array(
                        'name' => $this->input->post('client_name'),
                        'telephone' => $this->input->post('client_telephone'),
                        'address' => $this->input->post('client_address')
                    );
            
            /* Post to model */
            $this->load->model('clients_model');
            $this->clients_model->insert_client($client);        
            
            /* Redirect */
            $this->session->set_flashdata('msg', 'Client created successfully.');
            redirect('clients');
            
        }

clients view
Code:
<h2>Clients</h2>
            <div class="inner-box clearfix">
            
            &lt;?php if($this->session->flashdata('msg')): ?&gt;
            <div class="success">
                &lt;?=$this->session->flashdata('msg')?&gt;
            </div>
            &lt;?php endif; ?&gt;

It seems like the flashdata isn't even created as no text box is displayed. Any suggestions? Session is set in the autoloader.


Messages In This Thread
Flashdata redirect - by El Forum - 03-27-2010, 10:14 AM
Flashdata redirect - by El Forum - 03-27-2010, 11:48 AM
Flashdata redirect - by El Forum - 03-27-2010, 01:15 PM
Flashdata redirect - by El Forum - 03-27-2010, 01:28 PM
Flashdata redirect - by El Forum - 03-27-2010, 01:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB