Remove the strip_tags function highlighted below. I would do some
validation via regex if you are worried about faulty code. That should
work.
________________________________
From: Troy Oltmanns [mailto:toltmanns@stripped]
Sent: Thursday, July 16, 2009 1:03 PM
To: Joe Pavao
Cc: php@stripped
Subject: Re: html input element rendering html entities
$text_head=urlencode(strip_tags($_POST['text_head']));
// saves the heading into a variable on submit
$data = mysql_query("UPDATE products SET
DisplayType='$ProdDisplayType', Category1='$cat1', Category2='$cat2',
Category3='$cat3', Features='$html_features', HasVideo='$vidflag',
Headline='$text_head', Subhead='$text_sub' WHERE ModelNumber =
'$modnum'") or die(mysql_error());
// saves the variable to the db
<input type="text" name="text_head" maxlength="50" value="<?php
echo(urldecode($col['Headline'])) ?>" />
// displays the string in the input element
Bluetooth® Visor Mounted Car Kit
// the text string typed manually in the input element
Bluetooth(r) Visor Mounted Car Kit
// how it appears in the input when the page is reloaded
I'm not sure what you all need as far as table info. Among others, I
have a table called products that (among others) has a column called
Headline
On Thu, Jul 16, 2009 at 3:51 PM, Joe Pavao <jpavao@stripped> wrote:
Can you provide some of your code example and table information?
________________________________
From: Troy Oltmanns [mailto:toltmanns@stripped]
Sent: Thursday, July 16, 2009 12:39 PM
To: Joe Pavao
Cc: php@stripped
Subject: Re: html input element rendering html entities
I tried both of your suggestions to no avail.
On Thu, Jul 16, 2009 at 2:55 PM, Joe Pavao <jpavao@stripped> wrote:
Troy,
Try storing it as a blob. Use the urlencode() function in php
before sending it to the db, and use the urldecode() function when
grabbing it for disply.
Joe
-----Original Message-----
From: Troy Oltmanns [mailto:toltmanns@stripped]
Sent: Thursday, July 16, 2009 11:19 AM
To: php@stripped
Subject: Re: html input element rendering html entities
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*
--
MySQL PHP Mailing List
For list archives: http://lists.mysql.com/php
To unsubscribe: http://lists.mysql.com/php?unsub=1