Jump to content

[SOLVED] nl2br Problems


DanielHardy

Recommended Posts

I am applying this to a string as follows:

 


<?php echo $this->escape( nl2br($forum->comment));?>

 

However when i go the page to view the result it doesnt display the breaks, but the code to create them. I.e

 

My starting XI of all time would be:<br /> <br /> Goalkeeper: Peter Schmeicel<br />

 

Any ideas why?

I've looked for help on many a website but can't find a solution for what I deem to be a simple problem.

 

Thanks in advance

 

Daniel

Link to comment
https://forums.phpfreaks.com/topic/148492-solved-nl2br-problems/
Share on other sites

What does the escape function do?

 

If it uses htmlentities or strip_tags then that is your problem.

 

But if this is for inserting it into the DB I would not do nl2br before putting the data into the DB. Instead do it when retrieving the data. You want to store the data in it's raw format.

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.