faqts : Computers : Programming : Languages : PHP : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

12 of 14 people (86%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

How can I keep peole from entering html into my database? Just text.

Nov 15th, 2001 22:23
Anthony Boyd, Bill Coker,


When your form input comes in, let's say as variable $comment, just run 
it through the strip_tags function:
$cleantext = strip_tags($comment);
Then drop $cleantext into the database, instead of $comment.