php邮件程序未拾取日期选择器或选择时间
您好,我正在为一位伴侣制作一份联系表。他希望人们能够要求一个时间和日期。我使用过php邮件程序,它在使用输入类型文本时有效,但当我添加(jQuery)日期选择器和时间(select)时,它不会发送电子邮件。如有任何帮助,将不胜感激 我在下面的html表单的最后一部分添加了php邮件程序代码。 使用name=“rtime”表示时间选择,使用name=“rdate”表示日期选择器 表格代码如下uuuphp邮件程序未拾取日期选择器或选择时间,php,forms,select,datepicker,phpmailer,Php,Forms,Select,Datepicker,Phpmailer,您好,我正在为一位伴侣制作一份联系表。他希望人们能够要求一个时间和日期。我使用过php邮件程序,它在使用输入类型文本时有效,但当我添加(jQuery)日期选择器和时间(select)时,它不会发送电子邮件。如有任何帮助,将不胜感激 我在下面的html表单的最后一部分添加了php邮件程序代码。 使用name=“rtime”表示时间选择,使用name=“rdate”表示日期选择器 表格代码如下uuu <select name="rtime" id="">
<select name="rtime" id="">
<option value="" name="9am">9:00am</option>
<option value="" name="10am">10:00am</option>
<option value="" name="11am">11:00am</option>
<option value="" name="12pm">12:00pm</option>
<option value="" name="1pm">1:00pm</option>
<option value="" name="2pm">2:00pm</option>
<option value="" name="3pm">3:00pm</option>
<option value="" name="4pm">4:00pm</option>
</select>
<input type="text" id="datepicker" placeholder="Reqested Date" class="block col-10 mb2 field" name="rdate">
在您的选项中,您希望value=“9am”而不是name=“9am”感谢Matt!!
$name = $_POST["name"];
$fromEmail = $_POST["email"];
$phone = $_POST["phone"];
$message = $_POST["message"];
$rTime = $_POST["rtime"];
$rDate = $_POST["rdate"];
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
$mail->setFrom($fromEmail, 'Whitersmile Website Enquiry');
//Set an alternative reply-to address
$mail->addReplyTo($fromEmail, $name);
//Set who the message is to be sent to
$mail->addAddress('info@whitersmile.co.nz', 'Whitersmile Website Enquiry');
//Set the subject line
$mail->Subject = $name . ' has enquired on the website';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML("Name: ".$name."<br> Phone: ".$phone ."<br> Email: " .$fromEmail."<br> Requested time: ".$rTime."<br> Requested date: ".$rDate.
//send the message, check for errors
if (!$mail->send()) {
header("Location:../index.php#formWrapperContact");
} else {
header("Location:../index.php?message=Thank+You#thankyouMessage");
}
//header("");
}