# PHP - words filtering

**URL:** <https://forum.kirupa.com/t/php-words-filtering/196911>\
**Category:** programming\
**Created:** [August 11, 2006, 7:31pm UTC](https://forum.kirupa.com/t/php-words-filtering/196911 "2006-08-11T19:31:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjmaster\_j](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@jjmaster\_j](https://forum.kirupa.com/u/jjmaster_j)\
**Post date:** [August 11, 2006, 7:31pm UTC](https://forum.kirupa.com/t/php-words-filtering/196911/1 "2006-08-11T19:31:21Z")

</div>

Hello all,

## The code below is an example of a simple feedback form. However, this code does not allow words filtering words. In other words, anybody can enter any words he/she wants, including bad words and explicit sexual words. Is there a tutorial on how to filter unwanted words from the users?

\<html\>  
\<head\>  
\<title\>Listing 9.12 Sending mail from the form in Listing 9.11\</title\>  
\</head\>  
\<body\>  
\<?php  
print "Thank you, \<b\>$\_POST[name]\</b\>, for your message!\<br\>\<br\>

";  
print "Your e-mail address is: \<b\>$\_POST[email]\</b\>\<br\>\<br\>

";  
print "Your message was:\<br\>\<br\>

";  
print “$\_POST[message] \<br\>\<br\>”;

//start building the mail string  
$msg = "Name: $\_POST[name]  
";  
$msg .= "E-Mail: $\_POST[email]  
";  
$msg .= "Message: $\_POST[message]  
";

//set up the mail  
$recipient = "jacques@215d.com";  
$subject = “Form Submission Results”;  
$mailheaders = "From: My Web Site \<[jacques@215d.com](mailto:jacques@215d.com)\>  
";  
$mailheaders .= "Reply-To: $\_POST[email]

";

## //send the mail mail($recipient, $subject, $msg, $mailheaders); ?\> \</body\> \</html\>

Thank you  
jjmaster-j
