silversurfer5150 — 2012-01-04T18:11:32-05:00 — #1
will not strip the <p> tags from my string. I have read a lot of different posts but I'm not sure I trust the sources so I thought I'd ask on here as this is where I get the most sense.
So firstly, why doesn't it always work?
The string in question is "<p> T-Mobile* *18 *600 *unlimited *500Mb</p>"
Can anyone spot the problem?
Also if it doesn't work does anyone have a function solution which is short and streamlined.
scallioxtx — 2012-01-04T18:28:24-05:00 — #2
Are you sure that that is the string? It's not <p> T-Mobile* *18 *600 *unlimited *500Mb</p>
Look at the source of the webpage when you debug stuff like this, not at the webpage itself; it may trick you.
silversurfer5150 — 2012-01-04T18:33:38-05:00 — #3
Hi Scalliio, thanks for your reply
The problem is that this string is entered from a js based text editor plugin so I am not sure is being generated. I will have a look at the db.
So you're saying that strip_tags would ignore that because it isn't wrapped in <> or </>?
Which method would I use instead?
scallioxtx — 2012-01-04T18:46:25-05:00 — #4
You would first use html_entity_decode (whoever came up with that function name... :rolleyes:) so they become "legit" <p> and </p> and then you can apply strip_slashes
silversurfer5150 — 2012-01-04T18:52:37-05:00 — #5
Thanks so much for clearing that up for me, I am no stranger to php and yet it is only now that I seem to be learning some of the specifics that make it such powerful scripting language.
I must stop brushing these things under the carpet and telling myself, "its ok you know C and C++ so you pretty much know php" cos I clearly don't know it properly LOL
Thanks dude Have a good nite
scallioxtx — 2012-01-04T19:04:40-05:00 — #6
No problem. And a good night to you as well