Welcome Guest, Not a member yet? Register   Sign In
Newbie Questions
#1

[eluser]Ben Lilley[/eluser]
Hi people, this is my first day using CI, and also the start of my first project! Throwing myself in the deep end I know but I feel it's the way I learn the fastest. If possible, I'd like to use this thread to post questions as they pop up, rather than starting a whole bunch of threads, and I'd appreciate any help I can get.

My first issue is inserting data into the database using the form. I've read the user guide and also a couple of tutorials but everyone seems to do it a bit differently. Currently I'm thinking this:

1) Create function in controller called 'add', which loads a view that holds the form.
2) Use fills form in and hits submit which calls another function called 'add_new'
3) 'add_new' calls a model which uses something along the the lines of the code below to insert the data from the form into the db.
Code:
$this->db->insert('mytable');

First of all is this the best way of doing things? Second of all how do I get the form values from add to add_new and then get add_new to use the model to insert the data into the database.

Cheers


Messages In This Thread
Newbie Questions - by El Forum - 01-21-2009, 07:23 PM
Newbie Questions - by El Forum - 01-21-2009, 09:49 PM
Newbie Questions - by El Forum - 01-22-2009, 03:26 PM
Newbie Questions - by El Forum - 01-22-2009, 03:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB