Now that we've created each file and resource necessary for the app, let's run through a few scenarios so that we can get a good idea of how it all works together.
Let's consider an example where David visits the discussion forum in his browser. The following is the sequence of steps:
David clicks on the New Discussion link in the top navigation bar.
CodeIgniter loads the
create()
function in thediscussions
controller.The
create()
function displays thediscussions/new.php
view file, which displays a form to users, enabling them to enter their name, e-mail, discussion title, and discussion body text.David presses the Go button to submit the form. The form is submitted to the
discussion
controller'screate()
function.The
discussion
controller'screate()
function validates the form. Assuming there were no errors, thecreate()
function packages the post data into an array and sends it to thecreate()
function ofdiscussions_model
.The
create...