• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Text escaping / unescaping help

I hate myself for asking this question, but I can't seem to find a solution.

I have a text area, I am adding the contents to a database using active record. It's escaping all the apostrophes and adding \n's for line breaks, which is fine. I am happy with that.

How do I then take that data out of the database and display it in a nice manner? I tried using the typography helper, but it obviously doesn't work in conjunction with stripslashes which I need because of the escaped apostrophes.

Sorry for the stupid question!

In the main method call the method string helper:

When pulling the data go:

I think that should do it.

Thanks a lot...

I am still getting \n's turning into just"n"'s now, any it seems I can even have one or the other.

the php way to display multiline texts is
But if you use the form helper the form_prep function is similar.

Oh yes,
xwero that is the best way to do it. I misread his thread. I too use that function to do this Smile

Raaaaar this is driving me mad Smile

Entry looks like this in my database:

"line1\n\nline2" it's mysql_real_escape_string'd.

Then using <?=nl2br(htmlentities($text))?> I get:


What am I doing wrong? Sorry guys.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.