Im working on modifying my page once a user is logged in. (changing the login logo and display welcome username next to it). so far the img swapworks, but i cannot seem to add $userId into the script to display the sessions username, just the welcome back part works if i remove the $userId. Its weird because when i do this with PHP and HTML it works quite easily.
<?php
if (isset($_SESSION['logged_in'])) {
$userId = $_SESSION['username'];
echo '<script>
var img = document.getElementById("imgSwap");
img.src = "images/lockClosed.png";
</script>';
echo '<script>
var userId = '."$userId".';
var text = document.getElementById("loggedInMsg");
text.innerHTML = "Welcome Back, + userId";
</script>';
}
$userId = $_SESSION['username'];I would just name it what it is$username = $_SESSION['username'];