I am new in codeigniter. I have implemented a simple login system. I want to print out a username on my view page which is stored in sessions. here is my controller
<
Just store the user name in the userdata (you've already done this!)
$this->session->set_userdata('username') = 'John Doe';
And retrieve it just like that
$username = $this->session->userdata('username');
controller file $data = array( 'username' => $result->name, );
view file
<?php echo $this->session->userdata('username')?>
$username = $this->session->userdata('username');
//Pass it in an array to your view like
$data['username']=$username;
$this->load->view('test',$data);
//Then in you view you can display it as:
echo $username;