Jump to content

[SOLVED] Apostrophes and quotation marks in preloaded form text


lxndr

Recommended Posts

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.

 

 

 

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.

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.