0
Creating a whitespace in between my session variable output in PHP. I will do two posts with my code snippets for both examples
Hi I am trying to show my output with a space between names when I tap a login button. Right now the message outputs the Firstname and Lastname combined together rather than having a space in between the names. For example it prints out as TonySmith instead of Tony Smith.It tried incorporating a space with the non-breaking space, I also tried concatenating with double quotes like . “ “.Here is my code with quotes. print '<p>Hello, ' . $_SESSION['firstname']." ".$_SESSION ['lastname'].'! <p>';
5 odpowiedzi
+ 1
using PHP . here is my code using the non-breaking space,  . I am trying to make a space in my output so it outputs like Troy Johnson not TroyJohnson. I am using xampp localhost on my pc. please help
print '<p>Hello, ' . $_SESSION['firstname'].(' '). $_SESSION['lastname']. '!<p>';
+ 1
thanks for the example I will try it.
+ 1
thanks ICE, it was the double quotes versus using the single quotes. I got it to work you thanks alot. using double quotes fixed it
0
in which programming language have you written the code?
EDIT: ok it's in PHP, I think that adding . " " . should do the job... Not sure why it wont work in your code because you havent posted it
0
https://code.sololearn.com/wsiQ5sI09p3U/?ref=app
I've created a similar thing and it's working, maybe the reason for not working (in your code) is not closing <p> tag? Sorry I am not a backend expert so I cant help you more than this... Good luck