View Full Version : character
03-13-2007, 02:22 AM
I am retrieving data from the database and i noticed that one of the items has a " for inches in the word.When i display it in a table it displays perfectly but when i display it in a form field it only displays the characters before the ".
I understand why this is happening but i am wondering is there a way of preventing it?
03-13-2007, 02:32 AM
Try making it: "
03-13-2007, 02:33 AM
addslashes() and stripslashes()
Make sure magic_quote_gpc directive is not on.
03-13-2007, 02:40 AM
could it be anything to to with the text field because it works everywhere else?
i tried adding and stripping slashes on the value for the textfield but it's still not working
03-13-2007, 02:50 AM
I'm betting on it being an addslashes issue with magic_quotes_gpc()
magic_quotes_gpc is on by default in the php.ini. You can set this at PHP_INI_ALL level (so, anywhere). It works by automatically adding slashes to input fields that have been say, posted by a form. So, in your database its written as
Hello, I\'m Fou-Lu
Though display wise, it will not have the escape.
So, if you run addslashes prior to writting to a database, you have:
Hello, I\\\'m Fou-Lu
And only one set (\\) will be removed. Two solutions, don't addslashes to your db input (still use your mysql_real_escape_string though!), or disable the magic_quotes_gpc. I'd go for the magic quotes, this will make your script more portable for future usages.
Oops, guess the code would help:
03-13-2007, 02:56 AM
Thanks for your time.
I tired that too but it didnt work.
The word is something like "10" pizza" and the text box only displays "10".
03-13-2007, 03:26 AM
Sorry, I've been foolish.
htmlspecialchars() will parse it for text input fields. I was thinking on a text area.
03-13-2007, 03:40 AM
perfect your a star! thanks
03-13-2007, 04:18 AM
No problem bunny
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.