![]() |
need with date input? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: need with date input? (/showthread.php?tid=12454) Pages:
1
2
|
need with date input? - El Forum - 10-19-2008 [eluser]newbie boy[/eluser] how can i pass the date input from my html code which has 3 inputs: day: month: year: to mysql database which only has one field, the date field. thanks! need with date input? - El Forum - 10-20-2008 [eluser]Aken[/eluser] What format do you want your date to be in the database? The PHP function mktime() allows you to create a unix time stamp based on time/date variables. need with date input? - El Forum - 10-20-2008 [eluser]newbie boy[/eluser] YYYY-MM-DD formtat! need with date input? - El Forum - 10-20-2008 [eluser]newbie boy[/eluser] actually i can already input it on my database but the value would always be 0000-00-00, instead of the date i actually input on it from the html form. need with date input? - El Forum - 10-20-2008 [eluser]Aken[/eluser] Well you could just put the form values together... If you're using POST to submit the form... Code: $date = $this->input->post('year').'-'.$this->input->post('month').'-'.$this->input->post('day'); Then use the $date variable in your query. Pretty simple. need with date input? - El Forum - 10-20-2008 [eluser]newbie boy[/eluser] hey aken, that's exactly my code but still the output is 0000-00-00, instead of the actual date input. need with date input? - El Forum - 10-20-2008 [eluser]Aken[/eluser] Post your controller code and I'll take a look. (Make sure to use the code tags plz!) need with date input? - El Forum - 10-20-2008 [eluser]newbie boy[/eluser] i'm sorry aken, i dont know how to do the tagz, but here's my code my model: public function addMember($email,$birthday) { $this->email = $email; $this->birthday = $birthday; $this->save(); } my controller: public function registerMember() { $email = $this->input->post('email'); $birthday = $this->input->post('year')."-".$this->input->post('month')."-".$this->input->post('day'); $UserModel = new UserModel(); $UserModel->addMember($email,$birthday); echo $birthday; } thanks for the time. need with date input? - El Forum - 10-20-2008 [eluser]Aken[/eluser] What does your save() function consist of? (btw, hit the 'code' button above and paste your code inside it to get nice formatting like I had before) need with date input? - El Forum - 10-20-2008 [eluser]newbie boy[/eluser] Code: my model: hey, aken, it is actually working now! I just need to refresh my localhost add. I really appreciate your time. i hope you will always help those newbies like me and that there will be more like you who are willing to help. thanks! God bless!!! |