Re: Escaping from "<"
| From: | Christopher Heschong | Date: | Thu, 17 May 2001 01:32:56 +0000 |
| Subject: | Re: Escaping from "<" | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-53137@lists.php.net to get a copy of this message | ||
on 5/16/01 9:12 PM, Augusto Cesar Castoldi at castoldi@inf.ufsc.br wrote:
> I'm tring to print the variable "tmp", but the echo is just printing
> "abcd",
> the rest he can't print.
>
> Why?
>
> regards,
>
> Augusto
>
> $tmp="abcd<efg";
> echo $tmp."<br>";
> echo "<br>";
> $tmp=addslashes($tmp);
> echo $tmp."<br>";
> echo "<br>";
> $tmp=stripslashes($tmp);
> echo $tmp."<br>";
>
Try htmlspecialchars() instead of addslashes();
$tmp="abcd<efg";
echo htmlspecialchars($tmp);
--
/chris/