Good evening. Help advice, how do such things usually happen?
There are users, everyone has a city, region, country in the database.
Also on the site there is a filter where you can filter people either by city / or by region / or by country, as well as 'worldwide'. those. for example, we need to look at people from Moscow, choose the filter - 'city', drive Moscow - we get people from Moscow.
Now the question is: how to save the filter state? To the next time you visit the site, the choice of people remains in the cities, and it is in Moscow.
ci,Москва //где ci - "city" идентификатор того что ищем мы по городу также есть состояния "co" - country, 'r' - region
When we next visit the site, we see if there are any cookies, and if there is, read the status, in our case "ci" and search for cities of Muscovites. if you choose another filter, for example, you decide to search by country, cookies change, for example, to
co,Украина //теперь фильтровать будем по странам и выводить только Украину
If there is no cookie, or if it is deleted, we don’t use filters, we give out people "worldwide".
Is this a normal approach or can there be any better ideas?