Codeigniter uses m-v-c. i.e model view controller. Hhere i will give sample code how codeigniter works around mvc.
why codeigniter use the m-v-c architecture?
The back and front end of the application are separated and communicate using the controller,it will makes the code readable and easier to understand . Codeigniter separate the design(view) and back end operations ,i.e insert,delete etc(model) and connect using the controller.
what is model ?
Models have to do with connecting to a database and performing Create, Read, Update and Delete operations. Starting letter should be capital letter for the model class name where as class name equal to the file name .
what is controller ?
A Controller is simply a class file that is named in a way that can be associated with a URI.
Create the controller file form.php and the class name of the controller must be same as the file name and initial letter of the class name must be start with upper case other wise it is not valid.
what is view?
A view is simply a web page, or a page fragment, like a header, footer, sidebar, etc. In fact, views can flexibly be embedded within other views (within other views, etc., etc.) if you need this type of hierarchy.
Views are never called directly, they must be loaded by a controller. Remember that in an MVC framework, the Controller is responsible for fetching a particular view. If you have not read the Controllers page you should do so before continuing viewing.