du13932014807 2018-05-07 03:31
浏览 427
已采纳

如何使用PHP输入日期(使用输入表单日期)到文本?

I want to ask how to input date with format YYYYMMDD to txt file using PHP? here my code, but I just can input it using text not as date form :

<a> From : </a>                        // to show date after input
<?php                                 // to show date after input
echo file_get_contents(from.txt" );  // to show date after input
?>                                  // to show date after input
<?php
    $file = "/var/www/html/from.txt";
    if(isset($_POST))
    {
    $postedHTML = $_POST['html'];
    file_put_contents($file, $postedHTML);
    }
?>
<form action="" method="post">
    <?php
    $content = file_get_contents($file);
    echo "<textarea name='html'>" . htmlspecialchars($content) . "</textarea>";
    ?>
    <input type="submit" value="Click to enter date" />
</form>

enter image description here

  • 写回答

2条回答 默认 最新

  • duanjiao6731 2018-05-07 04:49
    关注

    try like this:

    <form action="" method="post">
        <?php
        $content = file_get_contents($file);
       echo"<input type='date' name='date'>";
        ?>
        <input type="submit" value="Click to enter date" />
    </form>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 R语言绘制生存曲线时出现警告:All aesthetics have length 1, but the data has 2 rows.
  • ¥15 苍穹外卖拦截器token为null
  • ¥15 pyqt怎么把滑块和输入框相互绑定,求解决!
  • ¥20 wpf datagrid单元闪烁效果失灵
  • ¥15 券商软件上市公司信息获取问题
  • ¥100 ensp启动设备蓝屏,代码clock_watchdog_timeout
  • ¥15 Android studio AVD启动不了
  • ¥15 陆空双模式无人机怎么做
  • ¥15 想咨询点问题,与算法转换,负荷预测,数字孪生有关
  • ¥15 C#中的编译平台的区别影响