Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8884479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:04:12+00:00 2026-06-14T21:04:12+00:00

I have a session for login data, and I am trying to take it

  • 0

I have a session for login data, and I am trying to take it and put it into a variable to shorten whenever I want to echo or use the ID, Username, or Email. What is happening is that now I have it in a variable, but when I echo it, it shows it in an array.

Here is my variable data.

$User = htmlentities(ucwords($_SESSION['user']['username']));
$Email = htmlentities($_SESSION['user']['email'], ENT_QUOTES, 'UTF-8');

If I echo any of these, it returns “Array”.

EDIT

I fixed my solution by changing how I get my $_SESSION data, and using unset to get rid of the array. Now I can just do this,

$User  = $_SESSION['user']["username"];
$Email = $_SESSION['user']["email"]; 

Thank you for reminding me about how I’m even getting my session data in the first place =]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:04:13+00:00Added an answer on June 14, 2026 at 9:04 pm

    If you are using classes, where you specify all your variables, maybe try this:

    $User  = $_SESSION['user']->username;
    echo $User;
    

    where user is your class and username is your variable
    WHen you add it to your session, you need to do soething like this:

        $_SESSION['user'] = new user();
        $_SESSION['user']->username= 'whatever value it is';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web-based system built with user login data based on session variables.
I'm trying to set up a simple login using AuthLogic into my User table.
I m trying to create a new register and login page. I have a
I am trying to login into this page but I cannot for the life
If I have a website with login and session management, and the pages uses
I have the following method which allows a user to login into my application:
I have a project where I am trying to login to sprint and then
I've been looking at using session_regenerate_id in a login class which I have been
I have a account page configured like the following; if(!isset($_SESSION[myusername])){ then show some login
I have a website, im using sessions for the login. In every pages of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.