Filter by Project
Learn how to handle a form with the GET method.
We'll cover the following...
In this lesson, we’ll focus on filtering data by project. This is the workflow that we’ll follow to filter the data project-wise:
- Create a basic form in
views/reports.php
. - Edit the controller and the model for the “Filter” feature.
- Run the application.
Basic implementation
Let’s create a form in our view with a list of all the projects:
<p>Filter by</p>
<form method="get">
<select name="filter" id="project">
<option value="">Select one</option>
<?php foreach ($projects as $project) : ?>
...