Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    141
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/user/public_html/development/load/account.php on line 9

    Code:
    <?php session_start(); ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Account Dashboard</title>
    </head>
    <body>
    <?php
    $name="$_SESSION['username']";
    echo "$name";
    ?>
    </body>
    </html>

  2. #2
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    it's because you're surrounding the session variable in ".
    PHP Code:
    // change this
    $name="$_SESSION['username']";

    // to this
    $name $_SESSION['username']; 

  3. #3
    Master Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    5,121
    Thanks
    110
    Thanked 602 Times in 589 Posts
    OR
    $name="$_SESSION[username]";

    also works.

    For more info on the use of quotes see the Quotes link in my signature below.
    Quote Originally Posted by deathshadow View Post
    So seriously, loosen up that tie, let out the belt, and try relating to normal people on the street instead of the gentleman's club crowd.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •