Hello,

I want to display the username after logging in .Right now i am getting only the first letter of my logging name.

I want to display the full name i.e username.

Here is my session code.

In login.php

<?
session_start();
session_register('name');
?>

In next page:

<?php
session_start():
$s_name=$_SESSION['name'];
?>
Hello <?php echo $s_name; ?>

I am getting only the first letter of my logging user.

    simbu wrote:
     session_register('name');

    You don't need this. Remove it. Use the [font=monospace]$_SESSION[/font] array instead.

    I am getting only the first letter of my logging user.

    That means [font=monospace]$_SESSION['name'][/font] only contains the first letter. The mistake is in whatever code you use to set its value.

    At a guess you have the name in a string but you're trying to access it as if it were in an array. But that's only a guess. You know better what you're doing than I do.

      Weedpacket;11018695 wrote:

      You don't need this. Remove it. Use the [font=monospace]$_SESSION[/font] array instead.

      That means [font=monospace]$_SESSION['name'][/font] only contains the first letter. The mistake is in whatever code you use to set its value.

      At a guess you have the name in a string but you're trying to access it as if it were in an array. But that's only a guess. You know better what you're doing than I do.

      Thank u so much....🙂 Got it.

        Great! Would you mind using the "Thread Tools" in the upper menu to mark this thread RESOLVED?

          Write a Reply...