webguync Posted April 9, 2009 Share Posted April 9, 2009 how would I add an HTML tag to this echo "Welcome! You are now logged in " . $_SESSION['username']; I tried... echo "<h3>Welcome! You are now logged in " . $_SESSION['username']</h3>; this gives me an error Quote Link to comment https://forums.phpfreaks.com/topic/153403-adding-html-to-this-line-of-code/ Share on other sites More sharing options...
ratcateme Posted April 9, 2009 Share Posted April 9, 2009 you need quotes around the last bit like this echo "<h3>Welcome! You are now logged in " . $_SESSION['username'] . "</h3>"; Scott. Quote Link to comment https://forums.phpfreaks.com/topic/153403-adding-html-to-this-line-of-code/#findComment-805946 Share on other sites More sharing options...
Maq Posted April 10, 2009 Share Posted April 10, 2009 You can also just put the variable in without breaking out of the string. The I have { } around it is because it's an associative array and has single quotes which will throw an error without them. echo "Welcome! You are now logged in {$_SESSION['username']}"; Quote Link to comment https://forums.phpfreaks.com/topic/153403-adding-html-to-this-line-of-code/#findComment-806004 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.