Eccolo ma chissà se è chiaro
Prima pagina
<?
include("../Configcg.php");

$Connessione = mysql_connect($Host,$Utente,$Pw) or die ("Nessuna Connessione");

$SelectDb = mysql_select_db($NomeDb,$Connessione);

//Seleziono Tabella Località

$sqlLoc = "select * from $Localita order by Localita";

$sqlLocRes = mysql_query($sqlLoc,$Connessione);

//Ciclo per località

while($RigheLoc=mysql_fetch_array($sqlLocRes)){

$IDLocalita = $RigheLoc ['IDLocalita'];

$Localita = $RigheLoc ['Localita'];

$htmLoc .= "<option value=\"$IDLocalita\">$Localita</option>" ;

}


//Seleziono Tabella Causale vendo affitto ecc

$sqlCausale = "select * from $Causale order by Causale";

$sqlCausaleRes = mysql_query($sqlCausale,$Connessione);

//Ciclo per Causale

while($RigheCausale=mysql_fetch_array($sqlCausaleR es)){

$IDCausale = $RigheCausale ['IDCausale'];

$Causale = $RigheCausale ['Causale'];

$htmCausale .= "<option value=\"$IDCausale\">$Causale</option>" ;

}

?>

II PAGINA DI RICERCA

include("../Configcg.php");

$Connessione = mysql_connect($Host,$Utente,$Pw) or die ("Nessuna Connessione");

$SelectDb = mysql_select_db($NomeDb,$Connessione);

//righe per non far scadere pagina
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //Controllo con queste righe la cache in modo da poter tornare indietro senza aggiornare
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

session_start() ;


//imposto le variabili di sessioni
if (isset($_POST['cmbLocalita'])) { $_SESSION['Loc'] = $_POST['cmbLocalita'] ; }
if (isset($_POST['cmbCausale'])) { $_SESSION['Cau'] = $_POST['cmbCausale'] ; }


//Seleziono Tabella Testa

if(empty($page)) $page=1; //Imposto pagina 1

$Inizio=($page-1)*10; // l'inizio che poi richiamo nel Limit


$sqlTesta = "select * from $Testa where IDLocalita= \"$Loc\"";//Sql per visualizzare in base a selezione fatta dall'utente


if($Cau != "Tutti"){

$sqlTesta .= "AND IDCausale = \"$Cau\"";

}


$sqlTesta .= "LIMIT $Inizio,10" ;

$sqlTestaRes = mysql_query($sqlTesta,$Connessione);

$TotRecordsRes = mysql_num_rows($sqlTestaRes);

//Preparo tabella per visualizzare risultati


$htmTab = "<table width=\"100%\" border=\"1\"><tr> <td colspan = \"5\" align=\"center\"><font color=\"#FF0000\" size =\"2\"> Numero Records in questa pagina $TotRecordsRes ---- Totale Generale $TotGenRecordsRes ----Pagina $page su un Totale di ".ceil($TotPag)."</td></font></tr> " ;

$htmTab .= "<table width=\"100%\" border=\"1\"><tr bgcolor=\"#FFFFD7\"><td>Localita</td><td>Immobile</td><td>Causale</td><td>Motivo</td><td>Stato</td></tr> " ;



while($RigheTab=mysql_fetch_array($sqlTestaRes)){

$IDTesta = $RigheTab['IDTesta'] ;

$IDLocalita = $RigheTab['IDLocalita'] ;

$IDCausale = $RigheTab['IDCausale'];


//Seleziono Tabella Località

$sqlLoc = "select * from $Localita where IDLocalita = \"$IDLocalita\"";

$sqlLocRes = mysql_query($sqlLoc,$Connessione);

//Ciclo per località

$RigheLoc=mysql_fetch_array($sqlLocRes);

$NomeIDLocalita = $RigheLoc ['IDLocalita'];

$NomeLocalita = $RigheLoc ['Localita'];


//Seleziono Tabella Causale vendo affitto ecc

$sqlCausale = "select * from $Causale where IDCausale = \"$IDCausale\"";

$sqlCausaleRes = mysql_query($sqlCausale,$Connessione);

//Ciclo per Causale

$RigheCausale=mysql_fetch_array($sqlCausaleRes);

$NomeIDCausale = $RigheCausale ['IDCausale'];

$NomeCausale = $RigheCausale ['Causale'];


$htmTab .= "<tr><td><a href = DettaglioPrincipale.php?IDTesta=$IDTesta>$NomeLoca lita</a></td><td>$NomeImmobile</td><td>$NomeCausale</td><td>$NomeMotivo</td><td>$Stato</td></tr>" ;


}

$p1 = $page-1; // diminuisco pagina di 1 per passare così la variabile $inizio a + 1 per il LIMIT

$p2 = $page+1; // aumento pagina di 1 per passare così la variabile $inizio a + 1 per il LIMIT

if($p1 != 0){

$PagPrec = "<a href=\"VistaPrincipale.php?page=$p1&cmbLocalita=$L oc&cmbTipoImmobile=$Imm&cmbCausale=$Cau&cmbMotivo= $Mot\">Indietro</a>" ;

}else{

$PagPrec = "Indietro" ;

}

if($p2 > ceil($TotPag)){

$PagSuc = "Avanti" ;

}else{

$PagSuc = "<a href=\"VistaPrincipale.php?page=$p2&cmbLocalita=$L oc&cmbTipoImmobile=$Imm&cmbCausale=$Cau&cmbMotivo= $Mot\">Avanti</a>" ;

}

$PrimaPagina = "<a href=\"VistaPrincipale.php?page=1&cmbLocalita=$Loc &cmbTipoImmobile=$Imm&cmbCausale=$Cau&cmbMotivo=$M ot\">Prima</a>" ;
$UltimaPagina = "<a href=\"VistaPrincipale.php?page=".ceil($TotPag)."& cmbLocalita=$Loc&cmbTipoImmobile=$Imm&cmbCausale=$ Cau&cmbMotivo=$Mot\">Ultima</a>" ;

$htmTab .= "<tr> <td colspan = \"5\" align=\"center\"><font color=\"#FF0000\" size = \"2\">$PrimaPagina --- $PagPrec --- $PagSuc --- $UltimaPagina</td></font></tr> " ;

$htmTab .= " </table>" ;

?>