...

View Full Version : html tags getting printed in <textarea>



bhakti_thakkar
07-14-2008, 06:50 AM
Hi all,
i am trying to display the address of the user in a textarea. (using PHPAJAX). i am already displaying the default address in the <textarea> and it works perfect with all breaks and nbsp;'s. But there is an option for the user to change it. i am using PHPAJAX to let the user select the id's from the list and display the address mapped to that ID is displayed in <textarea>.
the problem is now its displaying the address as below

Mr. ABC&amp;lt;br&amp;gt;POLAND

i tried using all possible options like htmlentities() , htmlspecialchars(), nl2br() but all is falling.

below is my code:


function main() {
$Relation_ID = & $this->Relation_ID;

global $db;
if ($Relation_ID!="") {

$Address =(htmlentities(GetRelAddress($Relation_ID)));
alert($Address);
aprint ('RelationInfo' , htmlentities($Address));
}
} // end


what should i do?

Thanks

Fou-Lu
07-14-2008, 07:53 AM
Hi, you need to decode the values instead of encoding them. Look into htmlspecialchars_decode (http://ca3.php.net/manual/en/function.htmlspecialchars-decode.php) and html_entity_decode (http://ca3.php.net/manual/en/function.html-entity-decode.php)

Hope that helps!

bhakti_thakkar
07-14-2008, 08:14 AM
that isnt helping too. still the same

Hope i get some help on it

Fou-Lu
07-14-2008, 09:12 AM
What is the code for GetRelAddress, aprint and alert? If the aprint or alert are also using htmlentities or htmlspecialchars you won't get the correct decoding on the given string. Check into those three functions and see if any of them make use of the same.

bhakti_thakkar
07-14-2008, 01:46 PM
Hello Fou-Lu,

MILLION THANKS TO YOU. you were right!!!! i was already using the htmlentities() in GetRelAddress(). Now i am directly using it and it works PERFECT



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum