-2

I would like to use HTML and PHP together. However it's not working.

I would like to have something like: Logged in as username

echo "<ul> <li>Logged in as</li> </ul>";

However I want to add $_SESSION['username'] to it within the listed object.

What is the best way to do this?

Cheers!

  • "not working" is not a sufficient problem description. Enable error reporting, then showcase the actual attempt. See the PHP manual on (curly) string interpolation. – mario Sep 02 '17 at 13:39
  • This should help: https://stackoverflow.com/questions/2150238/php-variable-in-html-no-other-way-then-php-echo-var – juzraai Sep 02 '17 at 13:39

1 Answers1

1

Not sure if I understand your problem, but have you tried:

echo "<ul> <li>Logged in as ".$_SESSION['username']."</li> </ul>";