![]() |
Help with preg_replace and regexp
Working on a small PHP mailer form project on Apache v1.3.36 to sent html-formatted mail.
Form is POSTed with message text in a textarea named COMMENT. Some code I'm adapting uses the following to strip linefeeds and replace with html breaks: Code:
$comment = preg_replace("/\n/","\n<BR>",$_POST[COMMENT]); I don't know beans about regular expressions. Can anybody help straighten this out? Or is there something else that needs to be done to have apostrophes show up correctly? |
Below that line add
PHP Code:
|
Why don't you just use the php function nl2br();
nl2br(string string) //Inserts HTML line breaks before all newlines in a string |
Quote:
Quote:
But still getting the \' , so still have to use stripslashes(). Any idea which of the two approaches is less server intensive? |
well, nl2br was made to do that and only that, so I would guess that is the best method.
|
All times are GMT. The time now is 06:20 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|