npsari Posted August 26, 2007 Share Posted August 26, 2007 hi there everyone, I am using a Noraml HTML form to submit Text When a user clicks on the submit button, a page opens up which previews what the user has typed print"<font color=\"#000000\" Font size=\"3\" Font face=Arial ><b>$Text12</b></font>"; But the above little code, always puts an / if the user types ' or " How can i avoid that, why does it put the / symbol before special characters Help guys Quote Link to comment https://forums.phpfreaks.com/topic/66785-print-function-is-adding-before/ Share on other sites More sharing options...
nathanmaxsonadil Posted August 26, 2007 Share Posted August 26, 2007 my guess is you are using http://us.php.net/addslashes Quote Link to comment https://forums.phpfreaks.com/topic/66785-print-function-is-adding-before/#findComment-334641 Share on other sites More sharing options...
nathanmaxsonadil Posted August 26, 2007 Share Posted August 26, 2007 you can remove addslashes or if you can't do that add http://us.php.net/manual/en/function.stripslashes.php Quote Link to comment https://forums.phpfreaks.com/topic/66785-print-function-is-adding-before/#findComment-334642 Share on other sites More sharing options...
npsari Posted August 26, 2007 Author Share Posted August 26, 2007 I am just using the normal print function Print""; but it always does it Ohh, i cant use the stripslashes, because the user will not know that he should put / before ' Quote Link to comment https://forums.phpfreaks.com/topic/66785-print-function-is-adding-before/#findComment-334643 Share on other sites More sharing options...
nathanmaxsonadil Posted August 26, 2007 Share Posted August 26, 2007 did you add slashes to $Text1? Quote Link to comment https://forums.phpfreaks.com/topic/66785-print-function-is-adding-before/#findComment-334644 Share on other sites More sharing options...
npsari Posted August 26, 2007 Author Share Posted August 26, 2007 how can i add slashes, i dont understand the $Text12 is a Text area in an HTML form And i use this to echo it print"<font color=\"#000000\" Font size=\"3\" Font face=Arial >$Text12</font>"; Users write anything in that Text area but when they put ' the print echos it ok, but puts / before it Quote Link to comment https://forums.phpfreaks.com/topic/66785-print-function-is-adding-before/#findComment-334649 Share on other sites More sharing options...
nathanmaxsonadil Posted August 26, 2007 Share Posted August 26, 2007 did you do somthing like this? addslashes($Text12); Quote Link to comment https://forums.phpfreaks.com/topic/66785-print-function-is-adding-before/#findComment-334651 Share on other sites More sharing options...
wildteen88 Posted August 26, 2007 Share Posted August 26, 2007 Your php setup most probably has a setting called magic_quotes_gpc. This setting will automatically escape quotes within _GET, _POST and _COOKIE data What you'll want to is: print"<font color=\"#000000\" Font size=\"3\" Font face=Arial >" . stripslashes($Text12) . "</font>"; Quote Link to comment https://forums.phpfreaks.com/topic/66785-print-function-is-adding-before/#findComment-334652 Share on other sites More sharing options...
Glyde Posted August 26, 2007 Share Posted August 26, 2007 Or the seemingly more standardized workaround: print get_magic_quotes_gpc() ? stripslashes($Text12) : $Test12; Quote Link to comment https://forums.phpfreaks.com/topic/66785-print-function-is-adding-before/#findComment-334656 Share on other sites More sharing options...
npsari Posted August 26, 2007 Author Share Posted August 26, 2007 Thanks guys, i will try all of them and if i had any trouble, i will re open the issue Quote Link to comment https://forums.phpfreaks.com/topic/66785-print-function-is-adding-before/#findComment-334657 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.