How Do I ignore html tags in my text Box Input in php

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
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

How Do I ignore html tags in my text Box Input in php

Post by amir »

How Do I ignore html tags in my text Box Input in php
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

It depends on what you mean by "ignore"... Do you mean like totally getting rid of them, or converting them something like this?

Code: Select all

<html>
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

Post by akimm »

PHP.net is a wonderful resource friend, i double checked myself for the correct answer here in a matter of 20 seconds.

Code: Select all

<?php
$string = "<h2>" . "hello" . "</h2>";
strip_tags($string);
?>
This code will evaluate string and remove any HTML tags, but let it be know, it also strips PHP from strings, however I believe this is what you want, otherwise, do as Oren said, ASCII safe characters I found this chart here, it should have everything you need:

http://www.web-source.net/symbols.htm
Post Reply