Re: fixing new lines from <textarea> in an email?

From: Date: Fri, 26 Jun 2009 16:37:51 +0000
Subject: Re: fixing new lines from <textarea> in an email?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-294660@lists.php.net to get a copy of this message
On Fri, Jun 26, 2009 at 12:27, Adam Williams<awilliam@mdah.state.ms.us> wrote: > I have staff fill out a form that contains a <textarea> with their problem > description and emailed to me when they click submit.  Staff will press > enter in the text area, but I'm having problems converting the \r\n into a > new line in the email that is sent to me, here is the code: [snip!] In a cursory glance, I've noticed the following code: htmlspecialchars(nl2br(str_replace('\r','',$_POST["problem"]))) You are using a literal '\r' in your str_replace() function. This should instead be replaced with double quotes to translate the \r to its appropriate EOL character: htmlspecialchars(nl2br(str_replace("\r",'',$_POST["problem"]))) -- </Daniel P. Brown> daniel.brown@parasane.net || danbrown@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Ask me about our fully-managed servers and proactive management clusters starting at just $200/mo.!

« previous php.general (#294660) next »