I have different search form on different pages for example at page i have a searchform on lefthand side. http://www.terra-reisen.com/
Similarly on preview page a form in header area http://www.terra-reisen.com/web/index.cfm/pm/uebersicht#1
and on detail page clicking on "Termine & preise" tab one can see another form. http://www.terra-reisen.com/web/index.cfm/pm/detail/idobjekt/4799/suchartFrom/uebersicht
Now what I want to develop is a kinf of Filter Container for each page. I mean If user filters some data on start page for example country=Austrie(in searchform) and come on preview page and filter again for a specific city and the comes to detail page now I have from detailpage come to preview page, the selected filters should be applied automatically and similarly from preview to startpage all the fileters should be applied.
Is there any design pattern or something like avialble for such sitution?
You should write a php script that creates a session with the filters, this script will also need to check if that session exists and if so to grab the filters from it and apply them.
You can write that script once and then just include it in all the pages. An example:
session_start();
$filters = array('location' , 'age' , 'language')
if (!isset($_SESSION['filters'])) {
if(array_key_exists('set_new_filters', $_POST)) //the name of the submit button of the filters form
{
foreach($filters as $filter)
{
$session_filters = $filter.":".$_POST[$filter].";";
}
$_SESSION['filters'] = $session_filters;
}
} else {
$user_filters = explode(";" , $_SESSION['filters']);
/*
$user_filters: Array (
[0] => location:somevalue
[1] => age:somevalue
[2] => language:somevalue
)
*/
}