Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8337797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:23:53+00:00 2026-06-09T04:23:53+00:00

Does anyone know how to put a space for the subject line in between

  • 0

Does anyone know how to put a space for the subject line in between echo-ing a variable and the string itself using the php mail()? I have tried this

$subject = $user_data->first .' '.'recommends a place';

and this

$subject = $user_data->first .' recommends a place';

But when the mail is send, it displays ‘Kevinrecommends a place’.

Here’s the full mail code:

$to = $form_input['email'];
$subject = $user_data->first .'  recommends a place on';


$msg = 
    'Hi,'."\r\n".
    "\r\n".
    'You were recommended a place by '.$user_data->first .'.'."\r\n".
    "\r\n".
    'Click the link to see it on **!'."\r\n".
    'www.**.com/'.$token."\r\n".
    "\r\n".
    'Cheers,'
    $from = 'From:noreply@**.com';


mail($to, $subject, $msg, $from);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:23:54+00:00Added an answer on June 9, 2026 at 4:23 am

    This should work:

    $subject = "{$user_data->first} recommends a place";
    

    Note the double quotes around the text. They are necessary to be sure $user_data->first gets interpreted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Classic ASP, does anyone know if it is possible (or advisable) to put
VIM: Does anyone know how to put a string from an input dialog in
Does anyone know of a way to contain a nonbreaking space in an html
Does anyone know why the content of my window is not put in the
Does anyone know if there is an easy way to put a border around
Does anyone know the step by step settings to put your app so it
Does anyone know what api level was the telephony manager class put in android.
Does anyone know if it is possible (and if it is, how?) to put
Does anyone know why if i put a printf just before a delay it
Does anyone know if I can put the MVC 1 project templates in VS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.