itsureboy Posted January 13, 2007 Share Posted January 13, 2007 When php use form data it puts a / (backslash) before every " (quote) and ' .What can i do to avoid this?Thanks..... Quote Link to comment https://forums.phpfreaks.com/topic/34062-problem-with-backslash-before-every-and-help/ Share on other sites More sharing options...
JJohnsenDK Posted January 13, 2007 Share Posted January 13, 2007 I dont understand your request completely, but i think you could use the explode() function.What is it you are trying to do with the script? Quote Link to comment https://forums.phpfreaks.com/topic/34062-problem-with-backslash-before-every-and-help/#findComment-160113 Share on other sites More sharing options...
itsureboy Posted January 13, 2007 Author Share Posted January 13, 2007 Ok i have a form with textarea and inside the textarea is code which i want to be printed on the page with the php but it will not display anything becase it put backslahes for ex.<textarea><style type="css/text"><textarea>and on the page it would read it as<style type=/"css/text"/> Quote Link to comment https://forums.phpfreaks.com/topic/34062-problem-with-backslash-before-every-and-help/#findComment-160118 Share on other sites More sharing options...
GingerRobot Posted January 13, 2007 Share Posted January 13, 2007 Yes, by default on most hosts, the php setting magic_quotes is turned on. This automatically excapes information from get and post data. Characters such as quotes, semi colons etc can either cause problems with your code or can be used for a malicious purpose. The magic_quotes setting prevents this.To remove the slashes for outputing the data etc, use the function stripslashes()http://uk2.php.net/stripslashes Quote Link to comment https://forums.phpfreaks.com/topic/34062-problem-with-backslash-before-every-and-help/#findComment-160123 Share on other sites More sharing options...
itsureboy Posted January 13, 2007 Author Share Posted January 13, 2007 Thanks for the info.How would i go about adding it to this form and php.PAGE W/ FORM:<html><head><title>Test Page</title></head><body><form action="test3.php" method="POST" target="foo" onSubmit="window.open("", "foo", "width=800,height=600,status=yes,resizable=yes,scrollbars=yes" )" class="form""><textarea name="mytextarea"></textarea><input type="submit" name="submit" value="Preview Myspace Layout"></form></body></html>----------------------------------------------------------------PAGE W/ PHP:<?phpecho $_POST['mytextarea'];?> Quote Link to comment https://forums.phpfreaks.com/topic/34062-problem-with-backslash-before-every-and-help/#findComment-160131 Share on other sites More sharing options...
Philip Posted January 13, 2007 Share Posted January 13, 2007 the php page:<?phpecho stripslashes($_POST['mytextarea']);?> Quote Link to comment https://forums.phpfreaks.com/topic/34062-problem-with-backslash-before-every-and-help/#findComment-160134 Share on other sites More sharing options...
itsureboy Posted January 13, 2007 Author Share Posted January 13, 2007 It Worked.....Thanks you and all who help...... Quote Link to comment https://forums.phpfreaks.com/topic/34062-problem-with-backslash-before-every-and-help/#findComment-160142 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.