let say I have a form:
<form ... >
<input type="text" name="date" /> //input here is 2013-06-14 09:00:00
</form>
I assigned it to let say:
$log = new record();
var_dump($log->timein = $_POST['date']); // OUTPUT is string(0) ""
I tried using manual update:
var_dump($log->timein = '2013-06-14 09:00:00'); //string(19) "2013-06-14 06:00:00"
what will I do so that the $log->timein
will get the value 2013-06-14 06:00:00 and not just empty strings?
if( isset($_POST['date']) && trim($_POST['date']) != '' ) {
$log->timein = $_POST['date'];
} else {
$log->timein = date('Y-m-d H:i:s');
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.