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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



how about preg_replace('/(\\n}\\r\\n)/', '<br />', $_POST["problem"]);

On Sat, Jun 27, 2009 at 12:50 AM, Adam Williams
<awilliam@xxxxxxxxxxxxxxxx>wrote:

>
>
> Daniel Brown wrote:
>
>>    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"])))
>>
>>
>>
>
> Thanks, I didn't know that single vs double quotes in that instance made a
> difference.  I've made the change to my code.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Best Regards!
Wen Dong

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux