Govinda wrote:
I've got a form that loads and saves product data to mysql. In some fields
like the heading and subhead we use special characters like Omega,
Registered Trademark, and Ampersand. When putting the data in I will encode them as Ω, etc. Once saved, all is good, everything goes ok and will display correctly in the user interface. However, if I go back to edit that product, in the html input element, it will actually display the character
rather than the entity code (although when checking the source, the html
entity is coded correctly). Then when it is saved, it saves as the illegal
character

I am newbie here, but isn't it that you just need to save at this ^^ point the same way that you saved the data in the first place?
If it worked the first time, why not now?

and will serve up a few funky characters in the user interface and
in the database.

I have the code stripping out tags and I tried to use the
mysql_real_escape_string to no avail.

Anyone have experience with this kind of thing?
PHP Version 5.1.6*MySQL 5.0.19*


That's the thing, it is being saved the same way, it's that when the page loads the data the input element automatically changes the display to the special character, and when it saves, it saves as that character.

then you just need to encode that form input value coming from the db back into the & entity, etc. AS YOU WRITE IT into the form input value HTML.
I suspect there must be a built-in function just for this purpose.

Someone can probably say what that is without looking (unlike me). But I did just look and how about this:
htmlspecialchars
?

-G


Try this: http://us2.php.net/manual/en/function.htmlentities.php


__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 4250 (20090716) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to