stickynote427 Posted May 17, 2009 Share Posted May 17, 2009 I made from scratch a form that will allow me to post news on my home page (a bit like a blog). I can successfully write data to the file I want to write data to, but if my news/blog post contains an apostrophe ('), it is written to the file as \' instead of the apostrophe by itself. I've tried using strtr() to replace \' with an apostrophe alone, but with no success. How should I do this? Any information is helpful. Thanks. Blake Link to comment https://forums.phpfreaks.com/topic/158512-trouble-correctly-showing-apostrophes-when-includeing-file/ Share on other sites More sharing options...
Mchl Posted May 17, 2009 Share Posted May 17, 2009 Check if you have magic quotes enabled. www.php.net/magic_quotes Link to comment https://forums.phpfreaks.com/topic/158512-trouble-correctly-showing-apostrophes-when-includeing-file/#findComment-835966 Share on other sites More sharing options...
BK87 Posted May 17, 2009 Share Posted May 17, 2009 use stripslashes function when displaying your information... more on php.net/stripslashes ex. $text="don\'t"; echo stripslashes($text); Link to comment https://forums.phpfreaks.com/topic/158512-trouble-correctly-showing-apostrophes-when-includeing-file/#findComment-835968 Share on other sites More sharing options...
stickynote427 Posted May 18, 2009 Author Share Posted May 18, 2009 @BK87: Thank you! It works perfectly! Link to comment https://forums.phpfreaks.com/topic/158512-trouble-correctly-showing-apostrophes-when-includeing-file/#findComment-836106 Share on other sites More sharing options...
MadTechie Posted May 18, 2009 Share Posted May 18, 2009 say thank you by clicking the topic solved.. and if possible evil turn magic quotes off Link to comment https://forums.phpfreaks.com/topic/158512-trouble-correctly-showing-apostrophes-when-includeing-file/#findComment-836109 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.