Click to See Complete Forum and Search --> : Removing HTML Tags from <a title=
eyecrave
12-23-2003, 01:33 AM
I'm attempting to grab info from my DB to put in the
<A href="link.htm" title="$strStuff">Whatever</a>
When I put the mouse over the link I get the
<br /> or <b></b>
showing up. How can I remove it? There must be a function built into PHP, but I don't know what I'm looking for.
Not sure if this is what you are looking for or not, but take a look at http://us2.php.net/manual/en/function.strip-tags.php.
eyecrave
12-23-2003, 05:43 PM
Head to http://test.eyecravedvd.com and highlight the "Sweetest Thing, The:..." you'll notice the pop-up contains the <br /> tags for the paragraph breaks. It's grabbing the info from the DB.
This must be done in IE BTW or it won't return the proper value.
Originally posted by eyecrave
you'll notice...Nope, I didn't. Where is it?
Paul Jr
12-23-2003, 07:07 PM
Originally posted by pyro
Nope, I didn't. Where is it?
Uhm... yeah, me neither.
I see it..
It's at the title parameter of the anchor tag of "Sweetest Thing, The:..." but it's url encoded so, strip_tags() (http://us2.php.net/manual/en/function.strip-tags.php) wont remove them. right, pyro?
Yes, that is correct (except that it does not appear to be urlencoded (http://us4.php.net/manual/en/function.urlencode.php), but rather that it was run through htmlentities (http://us4.php.net/manual/en/function.htmlentities.php) or htmlspecialchars (http://us4.php.net/manual/en/function.htmlspecialchars.php)). Conveniently, you can translate them back:
<?PHP
$trans = array_flip(get_html_translation_table(HTML_SPECIALCHARS)); # should be one line - forum formatting error
$str = "<b>bold text</b>";
$str = strtr($str, $trans);
echo $str;
?>
eyecrave
12-23-2003, 10:24 PM
I'll give it a try and let you know the results.
Thanks.
eyecrave
01-02-2004, 09:54 PM
I found the solution. It's really quite simple and I stumbled across it by accident.
strip_tags() (http://www.php.net/manual/en/function.strip-tags.php)
brendandonhue
01-02-2004, 10:28 PM
Found it by accident after two people posted it in this thread already :p
Yes, me thinks someone does not read the replies to their questions very well... :rolleyes:
eyecrave
01-03-2004, 12:17 AM
Actually, it was only mentioned once, ;) and seeing as he said this
I see it..
It's at the title parameter of the anchor tag of "Sweetest Thing, The:..." but it's url encoded so, strip_tags() wont remove them. right, pyro?
I didn't bother looking into it at the time, which was before Christmas I'd completely forgot about it. I guess I should have said... "The solution was strip_tags()"
I do appreciate the help though :D
Cheers!
Hmmm :( Sorry, I didn't know that strip-tags() also worked on encoded tags.. I wasn't quite sure of that, that's why I had to ask. :confused:
Anyways it's great that you had it fixed.:D
...and either way, I provided the way to convert back, if it did not... ;)