[eluser]mdcode[/eluser]
Yet another form question.
When a form is submitted, I am attempting to insert a date into the database using the CURDATE() parameter, however, it either fails to insert a row, inserts a 0, or just inputs CURDATE() into the field. I have also tried it with and without a hidden field in the form.
My VIEW:
Code:
<?php echo form_hidden('date_raised', 'CURDATE()'); ?>
CONTROLLER:
Code:
/* check if the form has been submitted */
if($this->input->post('submit_form'))
{
$this->projects_model->insert();
}
And my MODEL:
Code:
/* inserting the project data */
function insert()
{
$data = array(
'customer'=>$this->input->post('customer', TRUE),
'division'=>$this->input->post('division', TRUE),
'date_raised'=>$this->input->post('date_raised', TRUE),
'date_required'=>$this->input->post('date_required', TRUE),
'tech'=>$this->input->post('tech', TRUE),
'rep'=>$this->input->post('rep', TRUE),
'priority'=>$this->input->post('priority', TRUE),
'allocated_time'=>$this->input->post('allocated_time', TRUE),
);
$this->db->insert('projects',$data);
}
Ihave also tried this in the model:
Code:
'date_raised'=>CURDATE(),
both with and without quotes surrounding the CURDATE() and within parentheses. This just brings up the error:
Code:
Fatal error: Call to undefined function curdate()