表格中的空白和我的联系人页面的其他问题


empty spaces in form and other issues with my contacts page

我的联系人页面有一些问题。以下是部分:

<form method="post" action="mail.php">
      <input name="nome" type="text" style="width: 265px;" placeholder="Nome e Cognome">
      <input name="mail" type="email" style="width: 263px;" placeholder="E-mail">
      <textarea name="messaggio" placeholder="Messaggio"></textarea>
      <button type="submit" name="invia" style="margin-left: 0; margin-top: 10px;">Invia</button>
    </form>

.

<?php 

$to = "mail"; 

$subject = "Modulo proveniente dal sito www.miosito.it"; 

$body = "Contenuto del modulo:'n'n"; 
$body .= "Nome: " . trim(stripslashes($_POST["nome"])) . "'n"; 
$body .= "Email: " . trim(stripslashes($_POST["mail"])) . "'n"; 
$body .= "Messaggio: " . trim(stripslashes($_POST["messaggio"])) . "'n"; 

$headers = "From: Valle srl <info@vallesrl.com>";
"Content-Type: text/html; charset=iso-8859-1'n"; 

if(@mail($to, $subject, $body, $headers)) { 
header("Location: http://www.alessandrogiordano.me/test/valle02/sent.php");
} else {
header("Location: http://www.alessandrogiordano.me/test/valle02/nosent.php");
} 
?>

首先……如果我点击提交按钮与所有空白的电子邮件发送空白。即使我犯了一些错误,我得到了电子邮件发送的else消息…空白的很明显。我要疯了…我让这个网站免费为朋友,但我是一个平面设计师,而不是一个网页开发人员。再也不会!: D

帮助! !非常感谢。

把这一行放到你的页眉

$headers  = 'MIME-Version: 1.0' . "'r'n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "'r'n";

在发送邮件之前,必须验证所有字段是否为空

这样的

if( trim($_POST["nome"]) != "" )
 {
   // send mail
   $isMailSend =   mail($to, $subject, $body, $headers);
 }
 {
   //show error
 }
 if( $isMailSend ) { 
   header("Location: http://www.alessandrogiordano.me/test/valle02/sent.php");
  } else {
  header("Location: http://www.alessandrogiordano.me/test/valle02/nosent.php");
  } 

This

$headers = "From: Valle srl <info@vallesrl.com>";  
"Content-Type: text/html; charset=iso-8859-1'n"; 

应该是,

$headers = "From: Valle srl <info@vallesrl.com>";  
$headers. = "Content-Type: text/html; charset=iso-8859-1'n"; 

不能用type="email",应该用type="text"