php - "echo" session and logout in the same line


Currently when i showing my username(through session) and logout function , both of them is in different lines

Image: ( This is output )

What i want :
Username is on the right side of "Logout"




First of all, remove this partstyle='float:right;'

Usingfloat:right will move the text right.

Second, need some spacing here:

echo $_SESSION["username"]." "; // you can use `|` to separation 
echo '<a href="logout.php"><span>Logout</span></a></li>';



Float right will push everything to the right (last item being the one the the most on the right). Your code seem to work if you need to have everything on one line though.

session_start(); // Right at the top of your script

<li class='active'>
     echo '<a href="logout.php"><span>Logout</span></a>' . $_SESSION["username"];
     echo '<a href="registerform.html"><span>Login/Register</span></a>';

 echo '</li>';

People are also looking for solutions to the problem: php - Prestashop 1.6 Amount Tampering While Check Out


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.