PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Donny Bahama
Forum Newbie
Posts: 18 Joined: Wed Mar 22, 2006 2:48 pm
Post
by Donny Bahama » Thu May 17, 2007 3:26 pm
Using a form to post this string:
aaa "bbb" ccc 'ddd' eee
This code:
Code: Select all
$postmsg=$_POST['postmsg'];
echo $bdo."Before htmlentities, postmsg='$postmsg'.".$edo;
$postmsg=htmlentities($postmsg, ENT_QUOTES);
echo $bdo."After htmlentities, postmsg='$postmsg'.".$edo;
returns
After htmlentities, postmsg='aaa "bbb" ccc 'ddd' eee'.
I get the exact same results with htmlspecialchars. Any suggestions?
georgeoc
Forum Contributor
Posts: 166 Joined: Wed Aug 09, 2006 4:21 pm
Location: London, UK
Post
by georgeoc » Thu May 17, 2007 6:18 pm
Have you tried viewing the source of the printed text? You'll see:
Code: Select all
After htmlentities, postmsg='aaa "bbb" ccc 'ddd' eee'.
in the browser, but the source code is:
Code: Select all
After htmlentities, postmsg='aaa "bbb" ccc 'ddd' eee'.
Donny Bahama
Forum Newbie
Posts: 18 Joined: Wed Mar 22, 2006 2:48 pm
Post
by Donny Bahama » Fri May 18, 2007 10:07 am
OMG!I am such a f'ing IDIOT!!!
Thanks, George! Sometimes I guess it's hard to see the forest for all those trees!