Page 1 of 1

Issues with strip_tags(fixed)

Posted: Wed Jul 05, 2006 7:10 am
by Bigun
I was under the assumption that strip_tags would remove all tags except for the ones that are specified safe.

I setup the following strip_tags command:

Code: Select all

$inputaboutme=strip_tags($inputaboutme, '<a><b><i><u>');
$inputaboutme is a textarea.

When I put the following text into the textarea:

Code: Select all

<html>
<body background="http://www.cybergrunge.com/bg3.jpg">
<b>Testing 123</b>
</body>
</html>
It outputs this after processing:

Code: Select all

<html>
<body background=\"http://www.cybergrunge.com/bg3.jpg\">
<b>Testing 123</b>
</body>
</html>
Only thing I saw change was the quotes commented out for echo'ing.

Help?

*EDIT*

Corrected typo..

Posted: Wed Jul 05, 2006 7:51 am
by Bigun
Forgive me.... it is a textarea...

Posted: Wed Jul 05, 2006 7:52 am
by Weirdan

Code: Select all

<?php
$str = '
<html>
<body background="http://www.cybergrunge.com/bg3.jpg">
<b>Testing 123</b>
</body>
</html>
';
var_dump(phpversion());
var_dump(strip_tags($str, '<a><b><i><u>'));
?>
output:

Code: Select all

:!php q3.php
string(5) "4.4.0"
string(24) "


<b>Testing 123</b>


"

Posted: Wed Jul 05, 2006 7:57 am
by Bigun

Code: Select all

PHP Version 4.4.2
The only thing I can think of is my typo.

Would passing the value striaght from a textarea effect anything?

Posted: Wed Jul 05, 2006 8:02 am
by Bigun
Nevermind...

Posted the code in the wrong area..... my dumb*** fault...