Fatal error: Cannot redeclare clean_string() (previously declared in

hi there,
I m trying to send mail to many ,
but im getting an error Fatal error: Cannot redeclare clean_string() (previously declared in when i try to send to many .
One mail is successfully sent but when trying to send to many its giving error.
I took mail id’s into one variable and declared that in email_to.
Please have a look somebody
my code is

<?php $txtMessage=""; $txtStu=array(); //$txtStuFname[]=""; if(isset($_POST['submit'])) { $txtMessage=mysql_real_escape_string($_POST['txtMessage']); $txtStu=$_POST['txtStuFname']; $e=count($txtStu); echo $e; for($i=0;$i<$e;$i++) { echo ""; echo "THE VALUE OF ".$i; echo ""; echo $txtStu[$i]; echo ""; //echo "SELECT stu_email FROM stu_registration WHERE stu_fname='$txtStu[$i]' "; $queryelist=mysql_query("SELECT stu_email FROM stu_registration WHERE stu_fname='$txtStu[$i]' "); $elist=mysql_fetch_array($queryelist); echo "Email is ".$elist['stu_email']; $email_to =$elist['stu_email']; echo "Email To ".$email_to; $email_subject = "Student SMS :"; $email_from = "[email protected]"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "$txtStu[$i] , Your SMS : ".clean_string($txtMessage)."\n"; //$email_message .= "Student SMS: ".($txtMessage)."\n"; $headers = 'From: '.$email_from."\r\n". $headers .= "To:<".$email_to.">\n"; 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); } if (!$con) { echo "sorry"; die('Could not connect: ' . mysql_error()); } $query=mysql_query("INSERT INTO student_sms(student_message)VALUES('$txtMessage')"); if($query) { echo ""; echo "Student SMS Sent!"; } else { echo "SMS not Sent"; } } ?>

I hope some one understands my code and problem …
thanks

please only do one post per question
http://www.phphelp.com/forum/index.php?topic=19110.0

Sponsor our Newsletter | Privacy Policy | Terms of Service