Solved

Restoring fomat of textarea submission before email via php

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

708 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

18 Experts available now in Live!

Get 1:1 Help Now