ze1d Posted December 11, 2007 Share Posted December 11, 2007 Hi all,Whenever I pass a string (using form) with single quotation or double like "car" or 'car' and try to show it on the other page it replaces each quotation with \ like this \car\how can i disable this and make it look normal??Thanks very much,zeid Link to comment Share on other sites More sharing options...
justsomeguy Posted December 11, 2007 Share Posted December 11, 2007 You can use the get_magic_quotes_gpc function to test if the config option is set to do that, and if so you can use the stripslashes function to remove the slashes. Check the examples on this page, but you'll be using stripslashes instead of addslashes.http://www.php.net/manual/en/function.get-...-quotes-gpc.php Link to comment Share on other sites More sharing options...
ze1d Posted December 11, 2007 Author Share Posted December 11, 2007 but can i still be able to show the quotations?? Link to comment Share on other sites More sharing options...
ze1d Posted December 11, 2007 Author Share Posted December 11, 2007 man that worked fine with me THANKS!! .. but another question: what if I want to show this string in a text field (in the receiving page) because its not showing anything now in it Link to comment Share on other sites More sharing options...
justsomeguy Posted December 11, 2007 Share Posted December 11, 2007 You can use the value attribute of a text field to write whatever you want to appear as the default value. Link to comment Share on other sites More sharing options...
zppblood Posted December 12, 2007 Share Posted December 12, 2007 If you use $_GET as a value in a textbox, you will need to use htmlentities or htmlspecialchars.Here is what your code would look like if you didn't use these functions: <input type="text" value=""car"> As you can see it closes the value when using ". The functions prevent this from happening by replacing characters in HTML (such as <, >, &, ", and ' [you will need to use ENT_QUOTES for the second parameter in the functions for ' to be replaced]) with their entities (<, >, &, ", ').You enter "car" for the $_GET['q'] value. Here is what it will look like in the HTML: <input type="text" value=""car""> You can see that there is no way of getting out of the value by using " when it's being replaced.http://us2.php.net/manual/en/function.htmlentities.phphttp://us2.php.net/manual/en/function.htmlspecialchars.php Link to comment Share on other sites More sharing options...
ze1d Posted December 12, 2007 Author Share Posted December 12, 2007 ok thank you i will try that now! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.