Jump to content

Problem with backslash before every " and '...Help


itsureboy

Recommended Posts

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"/>

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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:


<?php
echo $_POST['mytextarea'];
?>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.