我正在为一个网站编写联系表格,但无法让它在实际电子邮件中发送我的表格字段。
电子邮件已成功发送和接收。
这是我的 HTML
<form action="mail.php" method="post" style="font-size:12px;">
<p>Name</p> <input type="text" name="name">
<p>Telephone</p><input type="text" name="phone" size="30" />
<p>Email</p> <input type="text" name="email">
<p>Message</p><textarea name="comments" rows="6" cols="25"></textarea><br />
<p>Best time to Contact You</p><input type="text" size="15" name="time" />
<input type="submit" value="Send"><input type="reset" value="Clear">
</form>
和我的 PHP
<?php
$to = "myemailaddress";
$subject = "New Website Enquiry";
$message = "You have recieved a new enquiry";
$from = $_POST['email'];
$name = $_POST['name'];
$message = $_POST['comments, phone, time'];
$headers = "From:" . $from;
$url = 'index.html';
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
mail($to,$subject,$message,$headers);
?>