Jump to content

[SOLVED] New Line command will not work in concatenate message string


AndrewJ1313

Recommended Posts

I have a form and after users submit the data, I want to organize all of the submitted data into a clean and easy to read message which will be email to me. Here is my code:

 

$message = 'Property id: ' . $_POST['id'] . '\n';
$message .= 'Property name: ' . $_POST['property_name'] . '\n';
$message .= 'Address: ' . $_POST['address'] . '\n';
$message .= 'City, State ZIP: ' . $_POST['city'] . ', ' . $_POST['state'] . ' '. $_POST['zip'] . '\n';
$message .= 'Phone number: ' . $_POST['phone'] . '\n';
$message .= 'Fax number: ' . $_POST['fax'] . '\n';
$message .= 'Image 1: ' . $_POST['image1'] . '\n';
$message .= 'Image 2: ' . $_POST['image2'] . '\n';
$message .= 'Image 3: ' . $_POST['image3'] . '\n';

 

My problem is that instead of creating each item on it's own line, the email is being sent like:

 

"Property id: 255\nProperty name: XXXX\nAddress: 123 Main Street\nCity, State ZIP: Sometown, State ZIP\nPhone number: 555-555-5555\nFax number: 555-555-5555\nImage 1: test\nImage 2: test\nImage 3: test\n"

 

Is there something I am doing wrong with the use of the new line (\n) code? I am working in PHP 5.

 

Thanks to all who respond,

Andrew

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.