HTML / PHP表单 - 输入类型“日期”

时间:2017-02-16 13:47:35

标签: php

我正在努力通过我的php表单处理器上的“日期”输入类型来发送电子邮件。 我尝试了各种编码但无法获得在电子邮件中显示的价值: - (

其他一切正常 - 非常感谢协助!

$name = $_POST['name'];
$visitor_email = $_POST['email'];
$reference = $_POST['reference'];
$date = $_POST['date'];
$amount = $_POST['amount'];

$email_from = 'my email here';
$email_subject = "Online Payment Notification";
$email_body = "You have received an online payment notification from $name.\n".
"please see details below:\n

Name: $name
Email: $visitor_email
Reference#: $reference
Date: $date
Amount: £$amount
";

$to = "my email here";
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
mail($to,$email_subject,$email_body,$headers);

1 个答案:

答案 0 :(得分:0)

  

[The]日期显示为YYYY-MM-DD,但我希望它显示为   DD-MM-YYYY

要将日期格式从YYYY-MM-DD更改为DD-MM-YYYY,只需替换以下代码行:

var _ = this;
$('.input-content').focus(
function(){
    //this is still the input
    _.clearMath()
})

使用:

$date = $_POST['date'];