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, &nbsp; I also tried concatenating with double quotes like . “ “.Here is my code with quotes. print '<p>Hello, ' . $_SESSION['firstname']." ".$_SESSION ['lastname'].'! <p>';

7th Feb 2018, 7:46 PM
Making A Change
Making A Change - avatar
5 Respuestas
+ 1
using PHP . here is my code using the non-breaking space, &nbsp. 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'].('&nbsp;'). $_SESSION['lastname']. '!<p>';
7th Feb 2018, 8:13 PM
Making A Change
Making A Change - avatar
+ 1
thanks for the example I will try it.
7th Feb 2018, 8:29 PM
Making A Change
Making A Change - avatar
+ 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
7th Feb 2018, 8:57 PM
Making A Change
Making A Change - avatar
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
7th Feb 2018, 7:57 PM
Ice
Ice - avatar
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
7th Feb 2018, 8:19 PM
Ice
Ice - avatar