# Add spaces to PHP variables

**URL:** <https://forum.kirupa.com/t/add-spaces-to-php-variables/177431>\
**Category:** programming\
**Created:** [February 1, 2006, 10:06pm UTC](https://forum.kirupa.com/t/add-spaces-to-php-variables/177431 "2006-02-01T22:06:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PCGamre](https://avatars.discourse-cdn.com/v4/letter/p/ea666f/32.png) [@PCGamre](https://forum.kirupa.com/u/PCGamre)\
**Post date:** [February 1, 2006, 10:06pm UTC](https://forum.kirupa.com/t/add-spaces-to-php-variables/177431/1 "2006-02-01T22:06:45Z")

</div>

I’m working on a large registration form with say, 30 vars in the PHP file.

I have :

$firstname = $\_POST[‘firstname’];  
$lastname = $\_POST[‘lastname’];

Later, to output to send to email, I have:

$sender\_name=$firstname . $lastname;

Okay, now, I’ve tried to use:  
$firstname = $\_POST[‘firstname’]. ’ ';

and it worked at first (I even tested it and saw the email), but since I’ve added more vars (b/c the amt of fields in my html form has increased), it doesn’t. It just gets ignored.

What I want is to add a space b/t the 2 so when the email gets sent, the “From” line of the email says, eg.:

From: John Doe

and not

From: JohnDoe
