Jump to content

[SOLVED] turn '&' into '&' on inserting into db


defeated

Recommended Posts

Hi,

My character encoding is UTF-8.  I am having problems validating pages because when I insert text from a form into my mysql db my ampersands show up as & instead of &.

my doctype is xhtml1.0 transitional.

 

Any suggestions. I don't really understand the difference between the encoding systems but was lead to believe that UTF-8 was the way to go.  Is there a simple way of fixing this or do I need to write some replace script? ???

 

To answer my own question......

Where I would have had

$mystring = $_REQUEST['mystring'] ;

I now have

$newstring= $_REQUEST['mystring'] ; //Fetches mystring from post or get methods and calls it $newstring
$mystring = str_replace("&","&","$newstring"); //replaces & with & in $newstring and renames it $mystring

I can then use $mytring as before.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.