My framework is codeigniter. I developed a form to store user inputs in the database. One input is there to fill the date and time automatically inside input box. But when I try to save it in the database, date does not save. Other values in the form saves in the database This is codeigniter view page
<?php $attributes = array("name" => "addclients");echo form_open("home/ExpenseSave", $attributes);?>
<div class="row">
<body onload="myFunction()">
<input type="text" id="demo" class="form-control"/>
</div>
<script>
function myFunction() {
$(document).ready(function(){
$('#demo').attr("placeholder", Date());
});
}
</script>
This is codeigniter controller page which saves data in database
$data = array(
'demo' => $this->input->post('demo'),
'pt' => $this->input->post('pt'),
'pn' => $this->input->post('pn'),
'task' => $this->input->post('task'),
'employee' => $this->input->post('employee'),
'projectname' => $this->input->post('projectname'),
'ExpenseName' => $this->input->post('ExpenseName'),
'ExpenseAmount' => $this->input->post('ExpenseAmount'),
);
if ($this->db->insert('expenses', $data))
In the database , data type for "demo" is datetime. Database is mysql