![]() |
Controller Insert data - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Controller Insert data (/showthread.php?tid=39427) |
Controller Insert data - El Forum - 03-10-2011 [eluser]ann91[/eluser] Hello everyone, I have difficulties about this code. whether this Controller is correct or not??? Code: function input(){ but, this is the model.. Code: <?php Can you fix it... ![]() Controller Insert data - El Forum - 03-10-2011 [eluser]InsiteFX[/eluser] ann91, Did you autoload your model? If not then you need to load your model in your controller. Also use single qoutes on your array field names. It would also help if you show your form code. InsiteFX Controller Insert data - El Forum - 03-10-2011 [eluser]ann91[/eluser] sorry this is a correct code.. i had load it, but the notice is "Use of undefined constant submit - assumed 'submit'" Code: if($this->form_validation->run()){ Controller Insert data - El Forum - 03-10-2011 [eluser]InsiteFX[/eluser] Try this ann91. Code: if($this->form_validation->run() == FALSE) InsiteFX Controller Insert data - El Forum - 03-10-2011 [eluser]ann91[/eluser] that's not what I meant, my form_validation has succeeded, about this Code: if ($this->input->post(submit)) the data not entered into the database yet.. Controller Insert data - El Forum - 03-10-2011 [eluser]InsiteFX[/eluser] Did you load your model and database? You do not need to check the submit! InsiteFX Controller Insert data - El Forum - 03-10-2011 [eluser]ann91[/eluser] yes, i had load it.. Controller Insert data - El Forum - 03-10-2011 [eluser]InsiteFX[/eluser] Let me explain this a little better for you, when you click on the submit button it passes back TRUE to the form_validation so it then carries out the else formseccess. If it is FALSE the it will load MyForm. Code: if($this->form_validation->run() == FALSE) No need to check for the submit button, use the code I showed you. I also need to see your form code for your views. InsiteFX |