NYCPHP Meetup

NYPHP.org

[nycphp-talk] HTML entities in posted variables problem

DeWitt, Michael mjdewitt at alexcommgrp.com
Wed Mar 17 09:43:00 EST 2004


Does anyone have a good idea of the best way to handle HTML entities in post
variables?  It seems that the entity will be converted to a rendered
character when the page returns making checks of the string used to set the
value against the returned (posted) value will fail.

For example

// ’ is the close quote

$a='Yes, It’s true';

echo '<input type="radio" name="q1" value="'.$a.'">'.$a;

.
.
.

if ($a==$_post['q1']) {
	echo 'A miracle happened';

}

Checking $_post['q1'], I find it is equal to "Yes it's true"
I have played around with other entities and it doesn't seem to be an issue
with just  quotes.

Does anyone have an idea of why this is happening and, perhaps, the best way
to handle this?  

I believe a similar question was posted back on the 2nd by Rahmin, but I
couldn't find any responses.  

Mike

 



More information about the talk mailing list