passing characters with get/post

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NewbiePHP
Forum Newbie
Posts: 4
Joined: Tue Jan 10, 2006 8:39 am

passing characters with get/post

Post 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
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Post 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);
NewbiePHP
Forum Newbie
Posts: 4
Joined: Tue Jan 10, 2006 8:39 am

Post by NewbiePHP »

works...!! woohoo.. cheers!
been trying to find a fix for ages!!..

cheers Skittlewidth
Post Reply