CodeIgniter Forums
DATE FIELD INSERTION THROUGH AR NOT WORKING - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: DATE FIELD INSERTION THROUGH AR NOT WORKING (/showthread.php?tid=51353)



DATE FIELD INSERTION THROUGH AR NOT WORKING - El Forum - 04-30-2012

[eluser]Unknown[/eluser]
I have written following code to get the date value from a form having date text box having id and name 'datepicker'. But it does not insert the InvDate properly in MySQL. It just inserts 0000-00-00 in my mysql backend. Kindly suggest based upon my following code.

Codes:-
$this->load->database();
$data= array(
'InvId' => $_POST['InvId'] ,
'InvTyp' => 'S' ,
'InvDate' => $_POST['datepicker']
);
$this->db->insert('tmpinvoice', $data);


DATE FIELD INSERTION THROUGH AR NOT WORKING - El Forum - 04-30-2012

[eluser]Stefan Hueg[/eluser]
First of all hello Captain Capslock,
secondly put your code into the [ code ] tags
and last but not least: What does the following line in your controller tell

Code:
var_dump($_POST['datepicker']);

...and use $this->input->post(...) for your own security Wink