Join Jon Peck for an in-depth discussion in this video Creating a form to add magazines, part of Learning PHP CodeIgniter (2013).
In order to implement a validating form in CodeIgniter, I'll need three things.…First, a controller function that contains the form logic, like processing submitted data.…Second, a view that contains the form itself, including a place for displaying messages.…And finally, a view for a message that will be shown upon successful submission.…Once I have those pieces, I can then add the validation logic.…I'm going to create a forum to add magazines and I'll start with the controller.…Within Net beans open the magazine controller.…
Let's add a new method for adding a magazine called add public function add,…give it a little bit of documentation. Add a magazine.…One of the parts of the magazine is the publication.…While it'd be great if users could remember data base identifiers, they tend…to get lazy and need all the help they can get.…Therefore, I'll populate the list of available publications on their behalf…using the publication model. Start by loading the model, populate publications.…
This load model, and I'll give it the publication as the argument.…
Starting with the what and why of CodeIgniter, Jon introduces key concepts such as the MVC pattern and libraries by demonstrating how to create static pages, then storing and displaying magazine info in a database. Advanced topics like classes and helpers are explored to validate user input, upload files, and much more. By creating a complete system, you'll have the foundation to build your own applications with CodeIgniter.
- What is CodeIgniter?
- Creating a static page controller
- Generating output with a view
- What is a model?
- Saving data with Active Records
- Creating forms
- Validating user input
- Listing records in tables
- Uploading images
- Viewing and deleting records