dfowler Posted February 21, 2008 Share Posted February 21, 2008 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? Quote Link to comment Share on other sites More sharing options...
revraz Posted February 21, 2008 Share Posted February 21, 2008 Are you using stripslashes when you bring it back out? Quote Link to comment Share on other sites More sharing options...
dfowler Posted February 21, 2008 Author Share Posted February 21, 2008 No, like I said. If I just echo the value normally it shows correctly; Wendy's. However, if I try to make it the value for the <input> it doesn't; Wendy. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 21, 2008 Share Posted February 21, 2008 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. Quote Link to comment Share on other sites More sharing options...
dfowler Posted February 21, 2008 Author Share Posted February 21, 2008 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.