duangejian6657 2017-02-16 13:47
浏览 76
已采纳

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

i am struggling to pull through a "Date" input type on my php form processor to email. I've tried various coding but cannot get the value to show on email :-(

everything else works - assistance would be greatly appreciated!

$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.
".
"please see details below:


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

$to = "my email here";
$headers = "From: $email_from 
";
$headers .= "Reply-To: $visitor_email 
";
mail($to,$email_subject,$email_body,$headers);
  • 写回答

1条回答 默认 最新

  • dsz90288 2017-02-16 14:06
    关注

    [The] Date is showing as YYYY-MM-DD but i want it to show as DD-MM-YYYY

    To change the format of the date from YYYY-MM-DD to DD-MM-YYYY, simply replace this line of code:

    $date = $_POST['date'];
    

    with:

    $date = date("d-m-Y", strtotime($_POST['date']));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题