Forum Moderators: coopster
I have an admin page where I can view submitted inputs from users. My problem is user can input things like this:
<a href="http://www.example.com"><img src="http://www.example.com/banner.gif"></a>
When I view it on my admin page, it display the actual banner, and NOT the code as shown above.
How can I make it display just the code and not the actual banner?
[edited by: eelixduppy at 2:51 am (utc) on June 7, 2007]
[edit reason] use example.com instead [/edit]
[edited by: eelixduppy at 11:57 am (utc) on June 7, 2007]
$html = '<a href="http://www.example.com"><img src="http://www.example.com/banner.gif"></a>';
echo $html; #without entities
echo htmlentities($html); #with entities
>> given that I cant predict the user input
The user input is wherever you are storing the code. I'm assuming you are storing the code somewhere?
echo htmlentities(nl2br($html));
I thought that is what you wanted, but I guess not ;)
glad you got it working!