[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">
<?php if($this->session->flashdata('msg')): ?>
<div class="success">
<?=$this->session->flashdata('msg')?>
</div>
<?php endif; ?>
It seems like the flashdata isn't even created as no text box is displayed. Any suggestions? Session is set in the autoloader.