Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.