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 7927103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:08:36+00:00 2026-06-03T19:08:36+00:00

I am not sure why the variable username is not being returned in the

  • 0

I am not sure why the variable username is not being returned in the session. When the user logs in, I start the session:

$username = trim($_POST['username']);
if(!isset($_SESSION)){ session_start(); }
$_SESSION[$this->GetLoginSessionVar()] = $username;

On the user’s welcome page, when I run the echo command, I see the proper variable being returned. But I’m not sure why the return statement isn’t working. I have the following in my PHP file:

function UserName()
{

    return  isset($_SESSION['name_of_user']) ? $_SESSION['name_of_user'] : "Unknown User" ;
    //echo $_SESSION['name_of_user'];
}

In my html, I have:

Welcome back <?PHP $fgmembersite->UserName(); ?>!

I also checked the session ID, and it’s also being generated properly.
Can you please help me understand what I’m doing wrong?

  • 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-03T19:08:39+00:00Added an answer on June 3, 2026 at 7:08 pm

    Is fgmembersite an object and have it the function called UserName ?

    If yes, you simply miss an echo

    <?PHP echo $fgmembersite->UserName(); ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a log in system for an application, and I'm not sure
I'm quite new in the wonderful world of C# and I'm not sure how
I have this script: <?php if ($_POST["username"]=="") { include($_SERVER['DOCUMENT_ROOT'] ."/login.inc.php"); } else { $username=$_POST["username"];
I'm not sure how to check for matches on my database when users login
I'm not massively experienced with JavaScript and I'm having trouble with variable scope and
Having a WCF service and a Consumer I'm not really sure how to handle
I am not sure how to explain this and not sure if thats the
I have a program in which the user enters a username and a date
The program is supposed to prompt the user for their username. Upon receiving the
I would like to create web application with admin/checkout sections being secured. Assuming I

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.