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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.