Removing unwanted characters

Hi guys, I’m trying to email myself and some data but within the data I keep getting “” in the email and I’m trying to delete them. The problem is coming from the information in the $content variable. I tried a string replace in the code below but this doest work.

Thanks in advance for your help


if(isset($_POST['Submit'])){
	   $content = $_POST['data'];
	   $name    = $_POST['name'];
	   $address = $_POST['address'];
	   $tel     = $_POST['tel'];
	   $email   = $_POST['email'];
	   $content.="<BR><BR>";
	   
	   $customer = "Customer Details::<br><br>";
	   $customer.= "Name       :: ".$name."<br>";
	   $customer.= "Address    :: ".$address."<br>";
	   $customer.= "Telephone  :: ".$tel."<br>";
	   $content1 = $content.$customer;
           $content1 = str_replace("Á", "", $content1);
           //$content1 = htmlspecialchars($content1);

	   

	   $from = $email;	  
 
	   $subject   = "Customer Order Form";
	   $recipient = "contact234@hotmail.co.uk";
	   $headers  = 'MIME-Version: 1.0' . "\\r\
";
	   $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\\r\
";
	   $headers .= "From: <$from>\\r\
";         
	   $mail = mail($recipient, $subject, $content1, $headers, "-f$from");  
	   if($mail){
		   echo '<span style="font-weight:bold; color:red; margin:100px 0 10px 250px;">Message sent successfully!</span>';
		   }					
	   
	 }
	 echo '<BR><BR><BR>';

Maybe change this line to

$headers .= 'Content-type: text/html; charset=[COLOR="Red"]UTF-8[/COLOR]' . "\\r\
";

and see if that helps.

Great thanks very much!

Did it work? I’d be interested to know, as it was just a guess. I would probably gather the body of the email something like, anyway:

$body = 
	"Name: $name\
\
" .
        "Address: $address\
\
" .
	"Email: $email\
\
" .
	"-----------------------------------------------------------\
\
" .
	"Content\
\
" . 
	$content ;

I know it was just hypothetical but ,“$content” probably shouldn’t be in quotes

Ah yes, thanks. Twas a typo done in haste. Edited now. :slight_smile: