Jump to content

Recommended Posts

Hi,

Can someone please tell me how to handle a string value containing a single quote when used in dynamically built html.

 

I have a form that posts back to itself. An input text field which first gets it's value from the database, containing string : haven't

this string is displayed correctly the first time, but when I post back the page to itself and repopulate the input text string with its $_POST value, the displayed string is now : haven\'t

 

why is the backslash inserted before the quote?

how should I handle this?

 

thanks,

thanks for the quick responses.

 

initially tried the htmlentities, but didn't do the trick, I think the Magic Quotes seems to be reason.

 

however, the the Magic Quotes link you inlcuded mentions a Warning - This feature is DEPRECATED and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.

 

So with this in mind should I just switch off magic_quotes_gpc or still use the stripslashes function?

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.