how to prevent user entered html tag?

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
kevin7
Forum Commoner
Posts: 96
Joined: Fri May 21, 2004 6:54 am

how to prevent user entered html tag?

Post by kevin7 »

how to prevent user entered html tag?
by checking for "<" and ">"?

how can i do that, can u show me an example?

thank you!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[php_man]htmlentities[/php_man]/[php_man]strip_tags[/php_man]
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

also look at regex or instr, to check for those values values, other solutions include replacing any < or > tags with something else like [ ] or the ascii equivalents...
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

For more information about strings and PHP check out: http://www.php.net/strings
Post Reply