This code works without a problem, but I would like to array the word from a database instead of having all of my filter words in the code.
<?php
function censor($string)
{
if($string)
{
// array of wear words and there replacements
$sweararray = array("good","hand","green","music");
$replacearray = array("great","fast hands","blue","the keyboard");
$newstring = str_ireplace($sweararray, $replacearray, $string);
return $newstring;
}
}
if($_POST['submit'])
{
echo censor($_POST['text']);
}
?>
<input type='button' name='t' value='SAVE'/>
<hr>
<form action="http://rewordmypaper.com/test/test.php" method="POST">
<textarea name='text'> </textarea >
<input type='submit' name='submit' value='submit' />
</form>
<?php
function censor($string)
{
if($string)
{
// array of wear words and there replacements
$sweararray = array("good","hand","green","music");
$replacearray = array("great","fast hands","blue","the keyboard");
$newstring = str_ireplace($sweararray, $replacearray, $string);
return $newstring;
}
}
if($_POST['submit'])
{
echo censor($_POST['text']);
}
?>
<input type='button' name='t' value='SAVE'/>
<hr>
<form action="http://rewordmypaper.com/test/test.php" method="POST">
<textarea name='text'> </textarea >
<input type='submit' name='submit' value='submit' />
</form>