Solved

Restoring fomat of textarea submission before email via php

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
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…

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now