我有这个代码,它应该发送邮件到一个地址。问题是:在标题中我应该得到像“Bob Marley”这样的名字,但如果名字大于一个单词,它会说“(未知发件人)”。如果名称恰好是一个词,它就可以工作。如果我将 $_POST['nume'] 值连接到 $message,它就在那里。出于某种原因,在标题中,它不能正常工作。
<form name="contact" method="post" class="clearfix" id="formular">
<input class="inputC" type="text" placeholder="Full Name" id="numeCo" onClick="clearValue(this.id)" onBlur="testValue(this.id)" name="nume"/>
<input class="inputC" type="text" placeholder="E-mail Address" id="adresaCo" onClick="clearValue(this.id)" onBlur="testValue(this.id)" name="adrMail"/>
<input class="inputC" type="text" placeholder="What services do you need?" id="serviciiCo" onClick="clearValue(this.id)" onBlur="testValue(this.id)" name="servicii"/>
<div class="sumarise">
<textarea class="textAreaC" placeholder="Please summarize your project..." id="textArCo" onClick="clearValue(this.id)" onBlur="testValue(this.id)" name="descriere"></textarea>
</div>
<div class="sB clearfix">
<input class="submitC" type="submit" value="Send Message" />
</div>
</form>
<?php
if(isset($_POST['nume'], $_POST['adrMail'], $_POST['descriere']))
{
/*echo "<script> return checkForm();</script>";*/
$to = "radu.mircea.andrei@gmail.com";
$subject = $_POST['servicii'];
$message = $_POST['descriere'];
$name = $_POST['nume'];
$headers= "From: ".$name."\n".'Reply-To: '.$_POST['adrMail'];
mail($to,$subject,$message,$headers);
}
?>