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. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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.