Jump to content

Quotes Issue


dfowler

Recommended Posts

Hey guys, I have an annoying little quotes issue.  I'm hoping somebody here can help me out.  I have created a form that inserts values into a database.  I use addslashes() for all the $_POST variables, and everything adds perfectly!  (ie O'Malley, Wendy's, etc..)

 

I have also created an edit page that displays these values in an <input> so they can be edited.  Here is where my problem is.  The values are stopping where the single quote is (ie O, Wendy, etc...).  However, if I just echo the variables they show perfectly.  What am I missing?

Link to comment
https://forums.phpfreaks.com/topic/92303-quotes-issue/
Share on other sites

I am sure this same problem was just posted and solved within the past few days.

 

Actual quotes that are output to the browser are operated on and rendered. So, a quote can/will break a value="..." parameter in a form field.

 

To output special characters that a browser would operate on as literal characters, use the htmlentities() function with ENT_QUOTES as the second parameter.

Link to comment
https://forums.phpfreaks.com/topic/92303-quotes-issue/#findComment-472931
Share on other sites

I am sure this same problem was just posted and solved within the past few days.

 

Actual quotes that are output to the browser are operated on and rendered. So, a quote can/will break a value="..." parameter in a form field.

 

To output special characters that a browser would operate on as literal characters, use the htmlentities() function with ENT_QUOTES as the second parameter.

Thanks, I tried searching for quotes but couldn't find any answers.  This solved it perfectly!

Link to comment
https://forums.phpfreaks.com/topic/92303-quotes-issue/#findComment-472941
Share on other sites

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.