[eluser]harpster[/eluser]
Just learning CI and getting used to the MVC concept with the on-line videos and examples in the CI User Guide. I'm not sure about this part so I'm going to show what I did that worked and ask for how others would do the same thing. Very simply I need to insert the current date with my posted form data. I suppose I could have done this with a hidden field in the view to include that in the POST array. Doing it in the model after the fact seems to take more code as shown below. Is there a way to simplify this or is it better to use a hidden field in the view for the date? Thanks!
Code:
function add_record()
{
$this->db->insert('cycling', $_data);
//Add CURRENT DATE to Record
$id=$this->db->insert_id(); //get id of last record
$this->db->where('id', $id);
$data = array('ridedate' => date('Y-m-d'));
$this->db->update('cycling', $data);
return;
}