Say i have a list of items on a page . Now this list can be filtered by price ( in a simple POST form ) OR by discount (in another form element) OR by category links in the sidebar.
Now if the user first filters by price and then clicks on a category, the first setting of filtering by price is lost! Whats the best way to have the old input stay ? So that the list of items is filtered both by category and price? I guess I can use sessions for this. But is there a better way of doing this in an MVC architecture (codeigniter) .
In the past I came up with code that looks like this :
echo " <a " ; //buiding category list
echo "href='" ;
if ( isset($_GET['colony'])) // if getting items from colony or walking distance
{
$colony = htmlspecialchars($_GET['colony']) ;
echo "show_delhi_items.php?colony={$colony}&category_id={$categories_row['id']}" ;
}
else // if getting all items
echo "show_delhi_items.php?category_id={$categories_row['id']} " ;
echo "'>{$categories_row['category']}</a></span> <br/>";
}
If anyone understood what I am trying to say , do guide me please
Thanks
Edit: The onyl way I can think of doing this is to have hidden form elements . Would that be a wise approach ?