Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-14-2008, 06:50 AM   PM User | #1
bhakti_thakkar
Regular Coder

 
Join Date: Sep 2006
Location: India Mumbai
Posts: 248
Thanks: 13
Thanked 1 Time in 1 Post
bhakti_thakkar is an unknown quantity at this point
html tags getting printed in <textarea>

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
bhakti_thakkar is offline   Reply With Quote
Old 07-14-2008, 07:53 AM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Hi, you need to decode the values instead of encoding them. Look into htmlspecialchars_decode and html_entity_decode

Hope that helps!
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 07-14-2008, 08:14 AM   PM User | #3
bhakti_thakkar
Regular Coder

 
Join Date: Sep 2006
Location: India Mumbai
Posts: 248
Thanks: 13
Thanked 1 Time in 1 Post
bhakti_thakkar is an unknown quantity at this point
that isnt helping too. still the same

Hope i get some help on it
bhakti_thakkar is offline   Reply With Quote
Old 07-14-2008, 09:12 AM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 07-14-2008, 01:46 PM   PM User | #5
bhakti_thakkar
Regular Coder

 
Join Date: Sep 2006
Location: India Mumbai
Posts: 248
Thanks: 13
Thanked 1 Time in 1 Post
bhakti_thakkar is an unknown quantity at this point
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
bhakti_thakkar is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:41 AM.


Advertisement
Log in to turn off these ads.