[eluser]Kemik[/eluser]
Hello,
Current Setup
Here's a snippet current controller for my registration script
Code:
// Form submission
if ($this->validation->run() == TRUE) {
// Load security helper and hash the password
$this->load->helper('security');
$password = dohash($this->input->post('pass'));
// Insert user
$this->user_model->create_user($this->input->post('username'), $password, $this->input->post('email'));
$data['valid'] = TRUE;
}
$data['header'] = 'Sign Up';
$data['page'] = 'user_create';
$this->load->view('container', $data);
user_create_view
Code:
<p><b>Edit User</b></p>
<?php if (isset($valid) && $valid == TRUE): ?>
<p>You're account has been created.</p>
<?php else: ?>
// form
<?php endif; ?>
To adjust this to use flashdata would the following be correct?
Code:
// Form submission
if ($this->validation->run() == TRUE) {
// Load security helper and hash the password
$this->load->helper('security');
$password = dohash($this->input->post('pass'));
// Insert user
$this->user_model->create_user($this->input->post('username'), $password, $this->input->post('email'));
$this->session->set_flashdata('msg', "You're account has been created.");
}
$data['header'] = 'Sign Up';
$data['page'] = 'user_create';
$this->load->view('container', $data);
And the view
Code:
<p><b>Edit User</b></p>
<?php if (isset($this->session->flashdata('msg'))): ?>
<p><?php echo $this->session->flashdata('msg'); ?></p>
<?php else: ?>
// form
<?php endif; ?>
If so, what's the difference flashdata provides?