PHP - words filtering

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>
";
$mailheaders .= "Reply-To: $_POST[email]

";

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

Thank you
jjmaster-j