when storing data to our DB2 database, I am running out textarea's through PHP's htmlentities function, and when it store's things like <br /> in the database, it stores it as:
And then when it displays on a page, it shows up like this:
got it to work<br /> with 'quotes'
[SIZE=small](got it to work<br
How can I get it to not display the <br /> code, but display the line break?
Well, option number 1 would be to not apply htmlentities() to it when you store it in the DB. (I don't just mean that facetiously: the database doesn't care if there are HTML tags in the data or not.)
But if you are stuck with it that way, you can undo the "damage" with html_entity_decode().
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
yup, i removed the htmlentities, and since we are using DB2, couldn't use addslashes because the \ is not a valid escape character, so had to replace all single quotes with 2 single quotes.
Now I have an issue, when I try to use double quotes, I'm storing the value in a hidden field on my confirmation screen, but when I have a value with double quotes, it's getting stripped from the sql, because it looks like this in the source of my confirmation screen:
Notice the 2 double quotes at the end. Any suggestions on how to my double quotes to work, so that from my confirmation page, when I press my submit button, it sends the data correctly to my update page?
<input type="hidden" name="plusup_message" value="got it to work<br /> it's a miracle "yeah"">
Thanks for the help!
nevermind, I got it working, adding htmlentities to my hidden value when populating it.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)