Inserting data into mysql from a form(What everybody assumes every newbie ought to figureout for himself/herself).Help i |
[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.
[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.
[eluser]phpserver[/eluser]
where do the validation function come in our controller?.
[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-gui...controller
|
Welcome Guest, Not a member yet? Register Sign In |