Jump to content

Replacing Quotes in Submitted Forms


leachus2002

Recommended Posts

Hi All,

 

I have a text field in a form that when submitted, passes the submitted data, using $_POST into a second webpage. I then use an insert statement on that page to insert the submitted text in to a DB.

 

I have finding that if user's place either a quote (") or a apostrophie (') in the form, it truncate's the insert statement, as it takes the characters as the end of the line.

 

Is there any other way of managing quotes and apostrophies in forms?

 

Cheers

Matt

 

Link to comment
https://forums.phpfreaks.com/topic/223662-replacing-quotes-in-submitted-forms/
Share on other sites

The actual problem is most likely when you are outputting the data on a web page. The ' or " is breaking the html on your page. You generally need to use htmlentities with the second parameter set to ENT_QUOTES when you output data on a page.

 

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.