defeated Posted May 26, 2008 Share Posted May 26, 2008 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 https://forums.phpfreaks.com/topic/107287-solved-turn-amp-into-ampamp-on-inserting-into-db/ Share on other sites More sharing options...
defeated Posted May 29, 2008 Author Share Posted May 29, 2008 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 https://forums.phpfreaks.com/topic/107287-solved-turn-amp-into-ampamp-on-inserting-into-db/#findComment-552401 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.