Page 1 of 1

passing characters with get/post

Posted: Tue Jan 10, 2006 8:43 am
by NewbiePHP
Hi all..
just started learn PHP .. use to do some basic ASP so got some idea of stuff but this is new to me..

I have opened a html or php code in a textarea box and then pass the edited or just visible code with a submit button.. but then its show on the next paged rendered is has \ in front of " , ' and \

How do i stop this happening..?

cheers all..

Mark

Posted: Tue Jan 10, 2006 9:10 am
by Skittlewidth
Sounds like you have magic quotes on in your PHP.ini settings.

Those characters have to be escaped with a backslash if you want them to be entered in a database.
To view your text as if the backslashes weren't there simply use the stripslashes() function:

Code: Select all

$text = $_POST['text_from_textarea'];

echo stripslashes($text);

Posted: Tue Jan 10, 2006 9:15 am
by NewbiePHP
works...!! woohoo.. cheers!
been trying to find a fix for ages!!..

cheers Skittlewidth