Okay, here are a few examples that will help put everything together.
The sequence of events in order to add a task is as follows:
The user visits the site and CodeIgniter routes them to the
tasks
controller.The
tasks
controller loads (by default) theindex()
function. Theindex()
function checks whether the form validation is false:if ($this->form_validation->run() == FALSE) { ...
As this is the first load and the form has not been submitted, it will equal
false
. Theindex()
function then defines the settings for thetask_desc
text field, calls theget_tasks()
function ofTasks_model
(which returns all tasks from the database), and then loads the view files, passing the database object to theviews/tasks/view.php
file.The user enters the
Chase meeting room booking
string, selects a date three days into the future, and clicks on Add to submit the form.The form is submitted and
index()
validates thetask_desc
form elements and the three date dropdowns...