KobusDippenaar Posted September 18, 2015 Share Posted September 18, 2015 Good day to you all, I have code a webpage accepting input and it allows text such as kobus' or Lynn's house but in a new website it does not. It causes the SQL Server to bomb out with an error. The PHP program was copied and changed to the new website. In both the Data Bases the field definitions are text. As part of a gallery upload program the text has to accept text such as Lynn's new house etc. Appreciate your feedback, Ok, I have added the program below. Blessings. 00imgupload.php Quote Link to comment https://forums.phpfreaks.com/topic/298208-apostrophe-in-textarea-or-input-text-statement-works-but-not-now/ Share on other sites More sharing options...
QuickOldCar Posted September 18, 2015 Share Posted September 18, 2015 strip_tags is doing you no good here $mydesc = strip_tags($_POST['mydesc']); You want to escape the data before inserting into mysql with mysqli_real_escape_string() As for character encoding and quotes back and forth to and from database back into html is a lot to go over, instead will link you to functions, you should know what they do before using them. trim() that incoming data of any whitespace html_entity_decode() htmlentities() htmlspecialchars_decode() htmlspecialchars() If your script works in one and not the other must be differences in php versions, php settings or server configuration Ensure magic_quotes is disabled Quote Link to comment https://forums.phpfreaks.com/topic/298208-apostrophe-in-textarea-or-input-text-statement-works-but-not-now/#findComment-1521081 Share on other sites More sharing options...
KobusDippenaar Posted September 18, 2015 Author Share Posted September 18, 2015 @Guru, Thanks for the comment, will have a look at it. What I do not understand, is that it is the same computer ie my laptop, nothing has changed and so my version of wampserver. I am running both website using wampserver and Firefox as browser. (localhost) Thank you once again for your assistance. Blessings Quote Link to comment https://forums.phpfreaks.com/topic/298208-apostrophe-in-textarea-or-input-text-statement-works-but-not-now/#findComment-1521085 Share on other sites More sharing options...
KobusDippenaar Posted September 18, 2015 Author Share Posted September 18, 2015 Thank you it is working after adding... $mydesc = mysqli_real_escape_string($dbCon, $mydesc); God Bless. Quote Link to comment https://forums.phpfreaks.com/topic/298208-apostrophe-in-textarea-or-input-text-statement-works-but-not-now/#findComment-1521087 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.