[eluser]anna16[/eluser]
Hi guys
I'm trying to display a data in view.
Here is the controller...
Code:
function login_account()
{
$this->data['username'] = $this->input->post('username');
//store data to session.
$this->session->set_userdata($this->data['username']);
//set form fields rules
$this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean');
$this->form_validation->set_rules('username', 'Username', 'callback_username_check2');
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'callback_password_check2');
if ($this->form_validation->run() == FALSE) //display the login form again if invalid data is encountered.
{
$this->load->view('template/login-template', $this->data);
}
else
{
$this->load->view('template/memberarea-template', $this->data);
}
}
Here is the view.
Code:
<table bgcolor="#FFFFFF" cellspacing="6">
<tr><td>
<fieldset>
<legend><b>Member Area</b></legend>
<?php echo "Welcome <b>", $this->session->userdata('username'); echo "</b> "; echo anchor('membership/site/login_form', 'Logout');?>
<br><br><br><br><br><br><br><br><br><br>
</fieldset>
</td></tr>
</table>
<br>
<?php #echo $username; ?><br>
<?php #echo $password; ?><br>
<br><br>
<?php echo validation_errors(); ?>
I just really want to display the
session username in the view.
But it doesn't display.
Thanks in advanced.