capturing session value in Codeigniter?

Hello, I am sorry that this is my third question in 3 days. I am having some difficulty in capturing my session value using codeigniter, I have done some looking around but I have not found an answer. My controller and view files are attached. Can someone let me know what the issue could be?




The error I am getting is: Undefined variable: username



Thanks for the help.

A
aej1973Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
No points for this because it's not an answer, but just a word of encouragement -- never feel that you have to apologize for asking questions.  It's the ones that don't ask questions that are handicapped.  The rest of us are in discourse and conversation all the time -- it's cordial and collegial, and we always learn things by asking and answering.
0
Ray PaseurCommented:
Just a guess but for the third snippet try this:
<?php

echo "My session value is " . $data['username'];

?>

Open in new window

0
aej1973Author Commented:
Hello Ray, thank you for your good words/advise, I appreciate it. I tried the suggestion you made but it does to work.

Thanks,
A
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Mukesh YadavFull Stack DeveloperCommented:
Replace line #15 in 2nd code block

$this->load->view("sessionvalue",$this->data) ; 

Open in new window


With

$this->load->view("sessionvalue",$data) ; 

Open in new window

0
Marco GasiFreelancerCommented:
Look at lines 14/15 of your second snippet:

             $data['username'] = $session_data['name'];  
             $this->load->view("sessionvalue",$this->data) ;

So your variable $username just doesn't exist. Don't use $this->data, use $data array instead. Go through all your code and replace $this->data with $data :-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
aej1973Author Commented:
Thank you, it works.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.