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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.
Ray PaseurCommented:
Just a guess but for the third snippet try this:

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


Open in new window

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.

Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

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

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

Open in new window


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

Open in new window

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 :-)

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.
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

From novice to tech pro — start learning today.