Can you tell me why this script is not working. It is not echo out the new phase with the filter words.
<?
/*****************************
filter.php
*****************************/
//$UserInput['comments'] would be the $_POSTED comment from the form
class word_filter{
function word_filter($UserInput){
//Connect to the database
$this->db_connection();
$this->query_string = "SELECT * FROM wordfilter";
$this->query = mysql_query($this->query_string);
$PWords=array();//Post words
$PWordsR=array();//Replacements
while($WF=mysql_fetch_assoc($this->query)){
extract($WF);
$PWords[]=$word;
$PWordsR[$word]=$replace_with;
}
foreach($PWords as $key=>$value){
$StripT=strip_tags($UserInput['comments']);
$Replace=str_ireplace($PWords,$PWordsR,$StripT);
}
$this->NUserInput=$Replace;
}
function db_connection(){
$dbhost = 'paper2010.db.7124637.hostedresource.com';
$dbuser = 'paper2010';
$dbpass = 'Lamonte24';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
$dbname = 'paper2010';
mysql_select_db($dbname);
//To include selecting the wordfilter database table
}
}
?>
Where do I put my echo statement and what echo statement would I use
<?
/*****************************
filter.php
*****************************/
//$UserInput['comments'] would be the $_POSTED comment from the form
class word_filter{
function word_filter($UserInput){
//Connect to the database
$this->db_connection();
$this->query_string = "SELECT * FROM wordfilter";
$this->query = mysql_query($this->query_string);
$PWords=array();//Post words
$PWordsR=array();//Replacements
while($WF=mysql_fetch_assoc($this->query)){
extract($WF);
$PWords[]=$word;
$PWordsR[$word]=$replace_with;
}
foreach($PWords as $key=>$value){
$StripT=strip_tags($UserInput['comments']);
$Replace=str_ireplace($PWords,$PWordsR,$StripT);
}
$this->NUserInput=$Replace;
}
function db_connection(){
$dbhost = 'paper2010.db.7124637.hostedresource.com';
$dbuser = 'paper2010';
$dbpass = 'Lamonte24';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
$dbname = 'paper2010';
mysql_select_db($dbname);
//To include selecting the wordfilter database table
}
}
?>
Where do I put my echo statement and what echo statement would I use