html input element rendering html entities

--0016364d246df61a1a046ed6708f
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hey guys and gals,

I have a little tricky situation so I will explain as best as I can.

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 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*

--0016364d246df61a1a046ed6708f--
Troy Oltmanns [ Do, 16 Juli 2009 20:00 ] [ ID #2008880 ]

Re: html input element rendering html entities

On Jul 16, 2009, at 12:00 PM, Troy Oltmanns wrote:

> Hey guys and gals,
>
> I have a little tricky situation so I will explain as best as I can.
>
> 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 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*

------------
Govinda
govinda.webdnatalk [at] gmail.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Govinda [ Do, 16 Juli 2009 20:36 ] [ ID #2008881 ]

Re: html input element rendering html entities

> 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*

------------
Govinda
govinda.webdnatalk [at] gmail.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Govinda [ Do, 16 Juli 2009 20:37 ] [ ID #2008882 ]

Re: html input element rendering html entities

--0016e6db66fad2932c046ed71b54
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

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.

On Thu, Jul 16, 2009 at 2:37 PM, Govinda <govinda.webdnatalk [at] gmail.com>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*
>>
>
> ------------
> Govinda
> govinda.webdnatalk [at] gmail.com
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--0016e6db66fad2932c046ed71b54--
Troy Oltmanns [ Do, 16 Juli 2009 20:47 ] [ ID #2008883 ]

Re: html input element rendering html entities

> 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


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Govinda [ Do, 16 Juli 2009 21:53 ] [ ID #2008884 ]

Re: html input element rendering html entities

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
Maureen Biorn [ Do, 16 Juli 2009 21:58 ] [ ID #2008885 ]

Re: html input element rendering html entities

--=_vserver1-26741-1247776050-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Am 2009-07-16 12:37:32, schrieb Govinda:
> 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?

If you have a <TEXTAREA> where you edit stuff, you can type a =A9 and if
you send it it will be encoded as ©.

Now if you like to edit again, it will be inserted as © and NOT =A9.

This mean, you have to revert the © to a literal =A9 before you show
it in the <TEXTAREA>.

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack c/o Shared Office KabelBW ICQ #328449886
+49/177/9351947 Blumenstasse 2 MSN LinuxMichi
+33/6/61925193 77694 Kehl/Germany IRC #Debian (irc.icq.com)

--=_vserver1-26741-1247776050-0001-2
Content-Type: application/pgp-signature; name="signature.pgp"
Content-Transfer-Encoding: 7bit
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFKX4wnC0FPBMSS+BIRAoa1AJ9BvuE5S9hMQAtH7U0NpfJOk2WutACg vqH3
MQbaR97h4ZPpSyk89xm81EQ=
=Tjux
-----END PGP SIGNATURE-----

--=_vserver1-26741-1247776050-0001-2--
Michelle Konzack [ Do, 16 Juli 2009 22:23 ] [ ID #2008886 ]
PHP » gmane.comp.php.database » html input element rendering html entities

Vorheriges Thema: finder
Nächstes Thema: general theory behind 'primary_key' & 'auto_increment' flags, and ON DUPLICATE KEY UPDATE ?