这是php代码,我只接收带主题的电子邮件,表格中没有填写任何正文或任何信息。
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: Afriartstyle.com';
$to = 'Myemail@gmail.com ';
$subject = 'Customer Inquiry';
$body ='From: $name\n E-Mail: $email\n Message:\n $message' ;
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html\r\n";
$headers .='From: from@example.com' . "\r\n" .
'Reply-To: reply@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
这是html代码,因为您可以看到有姓名,电子邮件和消息,它们没有出现在电子邮件中
<form id="main-contact-form" action="1.php" name="contact-form" method="POST" >
<div class="row wow fadeInUp" data-wow-duration="1000ms" data-wow-delay="300ms">
<div class="col-sm-6">
<div class="form-group">
<input type="text" input name="name" class="form-control" placeholder="Name" required="required">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="email" input name="email" class="form-control" placeholder="Email Address" required="required">
</div>
</div>
</div>
<div class="form-group">
<input type="text" input name="subject" class="form-control" placeholder="Subject" required="required">
</div>
<div class="form-group">
<textarea input name="message" id="message" class="form-control" rows="4" placeholder="Enter your message" required></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn-submit">Send Now</button>
</div>
</form>
答案 0 :(得分:0)
尝试使用单引号更改此$ body变量以进行双引号。 我希望有所帮助。
Input data :
**NAME PHONE ADDRESS**
anu 345@2 hyderabad
vinu 1234 raj^am
ram 234 vizag
kheer 233&3 vz1m
palni 1333 rap#d
Required output data:
**NAME PHONE ADDRESS**
anu 345@2 NULL
vinu NULL raj^am
kheer 233&3 NULL
plain NULL rap#d
请不要使用图片代码,我们很难复制和使用糊。