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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.