Solved

Restoring fomat of textarea submission before email via php

Posted on 2008-06-22
2
276 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

821 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