Join Jon Peck for an in-depth discussion in this video Avoid reinventing the wheel with the Form Helper, part of Up and Running with PHP CodeIgniter (2013).
- View Offline
The form helper is a great shortcut for quickly building forms.…Instead of writing raw HTML I can greatly simplify the view by using the form helper…functions to generate the markup. The form helper functions return html, so…they should be used in the view, not in the controller.…I will have to load the helper from the controller.…I'm going to switch back to Netbeans. And go to the add method if I'm not…already there. And add the method to load the form helper.…So, this, load, helper, form. Save the controller, then open the…magazine form the first line echoing the validation errors is good so let's leave…that alone. However I'm sorry to say that everything…else is going to get replaced. Its good to have perspective to know that…there's than one way to perform a task. I'm going to start with a new form using…the function form open PHP echo form open. I have the ability to specify a particular…action and attribute. But since it's posting to the same place I…can leave the action off and form open defaults to post so there's really nothing…
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