html_entity_decode()
Posted: Thu Sep 15, 2005 8:17 pm
So, I'm trying to make an edit feature for the blogging section.
I take one of my original examples from the database which looks like this:
The code I use to turn it into the editable version is this:
Now, when I echo this, it comes out fine.
But when I try to put it into a textarea, nothing is showing up. So I viewed the source of the HTML code, and it appears as though html_entity_decode isn't working... nor is the stripslashes =/
Edit: I see the [ code ] [ /code] block shows my entities as quotes, but the quotes are still entities in the HTML page source.
I take one of my original examples from the database which looks like this:
Code: Select all
I don\'t really write in here too much. I suppose I use this space to write introspective, inquisitive thoughts or ideas. And that doesn\'t really happen too often.
Perhaps I should write more <img src="smilies/biggrin.gif" alt="Smiley">. I\'ve enhanced this blog section quite nicely.. as I have most of the site. And I\'m still working every day to make it bigger and better. It r0x my s0x. So do you. =).
I\'m bouts to go fishing.. hopefully I catch something this time, and hopefully I didn\'t get sunburnt like last time.
Here\'s my sun burn from last time in case some of you haven\'t seen it yet.
<img src="http://www.showmypro.com/uploads/scrotaye/1119850355.jpg" alt="Blog Image">
Can you say <B>owww</B> ?
Perhaps I shall wear sunscreen... yes! sunscreen is the answer!
Okay, done rambling now. TATA FUX!Code: Select all
$thepost = stripslashes($blog['blogentry']);
$specialtext = array("lots of values");
$replacement = array("lots of values");
$smilies = array("lots of values");
$smiliesimg = array("lots of values");
$thepost2 = str_replace($smiliesimg, $smilies, $thepost);
$thepost3 = str_replace($replacement,$specialtext,$thepost2);
$thepost4 = html_entity_decode(strip_tags($thepost3));
$thepost5 = str_replace("<br />", "", $thepost4);But when I try to put it into a textarea, nothing is showing up. So I viewed the source of the HTML code, and it appears as though html_entity_decode isn't working... nor is the stripslashes =/
Code: Select all
<textarea name="blogentry" id="txtPost" rows="25" cols="40" value="I don\'t really write in here too much. I suppose I use this space to write introspective, inquisitive thoughts or ideas. And that doesn\'t really happen too often.
Perhaps I should write more :-D. I\'ve enhanced this blog section quite nicely.. as I have most of the site. And I\'m still working every day to make it bigger and better. It r0x my s0x. So do you. =).
I\'m bouts to go fishing.. hopefully I catch something this time, and hopefully I didn\'t get sunburnt like last time.
Here\'s my sun burn from last time in case some of you haven\'t seen it yet.
[IMG]http://www.showmypro.com/uploads/scrotaye/1119850355.jpg[/IMG]
Can you say [B]owww[/B] ?
Perhaps I shall wear sunscreen... yes! sunscreen is the answer!
Okay, done rambling now. TATA FUX!"></textarea>