Reputation: 2567
I have a dropdown, where I display some parameters, what can be used on retrieving data to user. I need send this parameter, and get correct data and then display it, but I know ways how I can do this, but I dont know what is the proper way. E.g. I can create the button, and click submit the value and return the data, or I can create a link, and then in controller use $_GET['parameter']
. But what are the best way to do this?
Upvotes: 1
Views: 504
Reputation: 2914
For filtering and sorting data, the probably best way to do, is to use query parameters like /thing/list?filter1=value1&filter2=value2&sort=value3
You don't have to create a specific route for getting your list filtered. You can just have a single route to get a kind of 'thing' in a list format.
In my opinion, it allow to:
let the user copy/past your list with his settings
do not break you user experience (if you come back from your history)
Upvotes: 2