I have a form with name, personalcode, fiscalcode and city. When the users write in the form I build the query and I make a pager. In the first step is ok, i have my data in the table with pager and the form.... but when user click in the pager or in the link to order the table, I lost the data in the form because the links are not correct.
The code is this:
[.....]
case t('search'):
$condition = '';
if ($edit['name']) {
if ($condition == '') $condition = ' name like \'%'.$edit['name'].'%\'';
else $condition .= ' AND name like \'%'.$edit['name'].'%\'';
}
if ($edit['fiscalcode']) {
if ($condition == '') $condition = ' fiscalcode like \'%'.$edit['fiscalcode'].'%\'';
else $condition .= ' AND fiscalcode like \'%'.$edit['fiscalcode'].'%\'';
}
if ($edit['personalcode']) {
if ($condition == '') $condition = ' personalcode like \'%'.$edit['personalcode'].'%\'';
else $condition .= ' AND personalcode like \'%'.$edit['personalcode'].'%\'';
}
if ($condition != '') $condition = ' WHERE '.$condition;
// Build the query
$sql = 'SELECT
id,
name,
city,
fiscalcode,
personalcode
FROM {gest_subject}
'.$condition;
// Title of table
$header = array(
array('data' => t('Nome/Ragione Sociale'), 'field' => 'name', 'sort' => 'desc'),
array('data' => t('Citta\''), 'field' => 'city'),