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.

 

 

 

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.