Apostrophe in form box

<?php
if ( isset($_POST['myForm']) )
{
$myForm=$_POST['myForm'];
}

else
{$myForm="";}

?>
<form action="myForm.php" method="post">
 <textArea name="myForm"><?php echo $myForm ?></textArea>
 <input type='submit'>
</form>

I have the code above in http://dot.kr/x-test/myForm.php

After I write the text “myText” and do submit, the text “myText” will be in the form box.

But After I write an apostrophe “'” and do submit, something another strange character(\) “maybe backslash?” is shown in front of the apostrophe “'” is in the form box.

How can I make it to remove another strange character?

it sounds like you have magic_quotes switched on in your php.ini file. You need to set it to “Off”.

if you don’t have access to your php.ini file then one option is to use stripslashes() to remove the backslash before displaying the string in your form.

Thank you. I set it “Off”.

you’re welcome :slight_smile: