猿问

如何在php的文本框中显示日期时间

当我更新日期时间的值但没有显示时。


编辑.php:-


<label>Attendance Date &nbsp;</label>

<?php 

        if (!empty($f_edit_student['date_added'])) { 

        $explodeImd = explode(" " ,$f_edit_student['date_added']);

        $date = $explodeImd[0];

        }

        ?>  

        <input type="datetime-local" value= "<?php echo $date; ?>"/>

更新.php:-


$student_no = $_POST['student_no'];

$firstname = $_POST['firstname'];

$middlename = $_POST['middlename'];

$lastname = $_POST['lastname'];

$course = $_POST['course'];

$section = $_POST['section'];

$status = $_POST['status'];

$udate = date('Y-m-d H:i:s');

$conn->query("UPDATE `student` SET `student_no` = '$student_no', `firstname` = '$firstname', `middlename` = '$middlename', `lastname` = '$lastname', `course` = '$course', `section` = '$section', `status` = '$status', `date_added` = '$udate' WHERE `student_id` = '$_REQUEST[student_id]'") or die(mysqli_error($conn));



ABOUTYOU
浏览 310回答 2
2回答

吃鸡游戏

如果您想存储当前日期时间,只需使用 MYSQL 的函数。mysqli_query("INSERT&nbsp;INTO&nbsp;`student`&nbsp;(`date_added`)&nbsp;VALUES&nbsp;(now())");

慕森卡

使用编辑查询:$udate = $_POST['udate'];&nbsp; &nbsp; $conn->query("UPDATE `student` SET `student_no` = '$student_no', `firstname` = '$firstname', `middlename` = '$middlename', `lastname` = '$lastname', `course` = '$course', `section` = '$section', `status` = '$status', `date_added` = '$udate' WHERE `student_id` = " . $_REQUEST['student_id']) or die(mysqli_error($conn));
随时随地看视频慕课网APP
我要回答