Jump to content

Cleaning new lines


Manixat

Recommended Posts

Hello freaks,

 

I have a textarea for writing comments where users can input many new lines and I'm trying to clean those lines but nothing seems to be working. I went all over all google results and tried every example both with preg replace and str replace and nothing seems to work. What I'm doing is first escaping the comment string then trim(preg_replace()). Am I doing the order wrong or idk what might be wrong. I tried like at least 20 syntaxes and none worked, and that's when I write a comment like

 

"asd

 

 

 

 

 

asd"

 

if I write a comment like 

 

"asd

 

 

 

 

 

 

"

 

then the new lines are gone in the display of the comment but are still saved in the database which I do not want ...

Link to comment
https://forums.phpfreaks.com/topic/276867-cleaning-new-lines/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.