dpp3047 2018-09-21 12:25
浏览 67


I am new to php and java etc, so i'm hacking it as i'm learning, but i've looked at every possible option and tried to adjust, but for some reason my code is still not working. I am calling the date and time in php file, and it submits the date and time to the email, but does not place it in my csv file (leaves a blank column).

I set the date and time with the first line and then the csv submit is after that (so i do not call the date and time via my html or anything


    $combinedDT = date('Y-m-d H:i:s', strtotime("$date $time"));

//start of the csv submission form

$filename = "wedding_website_email_form.csv";
$string = array($_POST['combinedDT'],$_POST['name_surname'],$_POST['telephone'],$_POST['email_from'],$_POST['rsvp'],$_POST['attendees'],$_POST['song'],$_POST['comments']);  

if (file_exists($filename)) {
        $file = fopen($filename, 'a');
        fputcsv($file, $string );
    } else {
        $file = fopen($filename, 'a'); 
        fputcsv($file, $string );


Is there a different way to call it than to the email function that works?

  • 写回答

1条回答 默认 最新

  • duanjiwei1283 2018-09-21 12:31

    It looks like you're calculating

    $combinedDT = date('Y-m-d H:i:s', strtotime("$date $time"));

    But then calling the line for your CSV from the global $_POST variable, not the locally calculated variable.

    $string = array($combinedDT, $_POST['name_surname']....);

    Should enter the locally calculated DateTime into the CSV.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 ImportError: DLL load failed while importing _iterative: 找不到指定的模块。
  • ¥15 控制工程研究生方向选择
  • ¥15 如何通过交互分析得出某高危患者对放疗获益更多
  • ¥15 相关性分析中,p<0.05, r=0.29,怎么评价相关性呢
  • ¥15 docker部署Mongodb后输入命令报错?
  • ¥15 将下列流程图转变成python程序代码
  • ¥15 我需要全国每个城市的最新小区名字等数据。
  • ¥15 开发一个小区生态的小程序
  • ¥15 如何解决Excel中dependent dropdown list 的问题
  • ¥15 MddBootstrapInitialize2失败