Inserting data into mysql from a form(What everybody assumes every newbie ought to figureout for himself/herself).Help i - 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: Inserting data into mysql from a form(What everybody assumes every newbie ought to figureout for himself/herself).Help i (/showthread.php?tid=13201) |
Inserting data into mysql from a form(What everybody assumes every newbie ought to figureout for himself/herself).Help i - El Forum - 11-14-2008 [eluser]phpserver[/eluser] View::: myform.php Controller <? class Arc extends Controller { //Validation function included function insert_into_mysql() { //Help } } ?> Model <? class Model extends Controller{ function insert() { //help } } ?> I have spent a whole week trying to insert data from a form into mysql,i have failed terribly. I am used to using '$_POST[email]' format when posting data and nothing so far works. I want to insert email and username into a database from a form as you can gather from above. Will somebody come to my resque,its friday goddamn it,it has been a long five days. Inserting data into mysql from a form(What everybody assumes every newbie ought to figureout for himself/herself).Help i - El Forum - 11-14-2008 [eluser]Murodese[/eluser] You're a bit mixed up. The controller defines functions that are uri-friendly, so in your case, you'd probably want it to look more like this; Controller (arc.php): Code: class Arc extends Controller Model (arc_model.php): Code: class Arc_model extends Model View (userform.php) would be whatever your html forms are (form names would be username, email and submit). Set up like this, you'd go to http://baseurl/index.php/arc/create and give your form a submit of the same url, and it'd add the row to your db. Inserting data into mysql from a form(What everybody assumes every newbie ought to figureout for himself/herself).Help i - El Forum - 11-14-2008 [eluser]phpserver[/eluser] where do the validation function come in our controller?. Inserting data into mysql from a form(What everybody assumes every newbie ought to figureout for himself/herself).Help i - El Forum - 11-14-2008 [eluser]Murodese[/eluser] The validation functions would pretty much replace the if($this->input->post('submit')) that I have there. There's a lot of examples on the validation user guide page, check it out. http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#thecontroller Inserting data into mysql from a form(What everybody assumes every newbie ought to figureout for himself/herself).Help i - El Forum - 11-14-2008 [eluser]phpserver[/eluser] Thanks a lot Murodese. |