...

View Full Version : Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING



amcf1992
09-14-2011, 03:48 AM
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


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

BluePanther
09-14-2011, 03:53 AM
it's because you're surrounding the session variable in ".


// change this
$name="$_SESSION['username']";

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

tangoforce
09-14-2011, 01:31 PM
OR
$name="$_SESSION[username]";

also works.

For more info on the use of quotes see the Quotes link in my signature below.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum