[RESOLVED] Escape Characters
I have an odd problem. See the following two simple scripts:
HTML Code:
<form id='testForm' action='submit.php' method='post'>
<textarea id='testText'></textarea>
<input type='submit' />
</form>
PHP Code:
<?php
die($_POST["testText"]);
?>
When you enter anything in the textarea, the PHP script immediately contains escape characters. For example: If I type: "It's good", the php script will print out "It\s good".
This only happens on my hosted solution though. The host is using Linux (don't know which distro) with php 5.0, though on my local machine using WAMP server (php 5.2.6) this doesn't happen. I can enter just about anything without escape characters returning.
Does anyone know why this is happening and how to correct it?
Re: [RESOLVED] Escape Characters
if you don't want to bother with your htaccess file, you could also just use stripslashes().
Re: [RESOLVED] Escape Characters
I've been using stripslashes, though I've had some issues with it that I'd rather not go into now. (Tripping over mysql_real_escape_string, etc...)
I'm now just going to use str_replace to replace all "reserved" characters with HTML codes.
(EG: apostrophe -> & # 3 9 ; )