Solved

Restoring fomat of textarea submission before email via php

Posted on 2008-06-22
2
275 Views
Last Modified: 2008-06-29
I have a simple form submitted that includes a textarea.  If the user adds multiple carriage returns to open up white space in the submission, I need to preserve that formatting when the script recieves it via post and processes it for email to me.

Right now, php removes all the line breaks and new lines and sends me the concatenated paragraph.
The name of the textarea is "message" and so I am attempting to access it through $_REQUESTmessage].  But all the newlines and returns are already removed from that variable.  

I've tried to find this answer everywhere, please help.
0
Comment
Question by:marcimhof
2 Comments
 
LVL 28

Accepted Solution

by:
gamebits earned 50 total points
ID: 21842481
$message = nl2br($_rEQUEST['message']);
0
 

Author Comment

by:marcimhof
ID: 21842512
That does put the <br> into the string the required numebr of times to preserve it on the browser.

So, now if I want to send $message t othe function to send the email, it will have <br> insterad of the \r\n which would be better if sending a completely text email correct?

Before I send it, should I replace al lthe <br> with \r\n ?
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

823 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question