lxndr Posted June 20, 2009 Share Posted June 20, 2009 I need to be able to read in some text from a MySQL table and then pre-load it into an input element within a form. I'm having trouble getting it to work if the pre-loaded input has BOTH apostrophes and quotation marks in it and can't seem to find a way round it. For example the html to be output would be something like: <input type="text" name="field" value=" php string variable here "> where the php string variable but is being read in from an SQL row. Link to comment https://forums.phpfreaks.com/topic/162988-solved-apostrophes-and-quotation-marks-in-preloaded-form-text/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 20, 2009 Share Posted June 20, 2009 You need to use htmlentities with the second parameter set to ENT_QUOTES in order to output data on a web page that could contain HTML special characters in order to keep those special characters from breaking the HTML code on the page. Link to comment https://forums.phpfreaks.com/topic/162988-solved-apostrophes-and-quotation-marks-in-preloaded-form-text/#findComment-860004 Share on other sites More sharing options...
lxndr Posted June 20, 2009 Author Share Posted June 20, 2009 You need to use htmlentities with the second parameter set to ENT_QUOTES in order to output data on a web page that could contain HTML special characters in order to keep those special characters from breaking the HTML code on the page. Ah, that fixed it. Many thanks for your help, it's much appreciated. Link to comment https://forums.phpfreaks.com/topic/162988-solved-apostrophes-and-quotation-marks-in-preloaded-form-text/#findComment-860009 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.