Fai la form in una pagina a parte con method="get"
In questa pagina, invece, le cose da cambiare sono quelle segnate in rosso:
codice:
<%
risultatiPerPagina = 10
pagina = request.queryString("pagina")
if len(pagina) > 0 and isNumeric(pagina) then
pagina = cLng(pagina)
else
pagina = 1
end if
if pagina < 1 then pagina = 1
questaPagina = request.serverVariables("PATH_INFO")
tipologia = request.queryString("tipologia")
sottotipologia = request.queryString("sottotipologia")
regione = request.queryString("regione")
provincia = request.queryString("provincia")
comune = request.queryString("comune")
qString = "tipologia=" & server.URLEncode(tipologia) & "&sottotipologia=" & server.URLEncode(sottotipologia) & "®ione=" & server.URLEncode(regione) & "&provincia=" & server.URLEncode(provincia) & "&comune=" & server.URLEncode(comune)
function fixSQL(theString)
theString = replace(theString,"'","''")
theString = replace(theString,"%","[%]")
theString = replace(theString,"#","[#]")
theString = replace(theString,"_","[_]")
theString = replace(theString,"[","[[]")
theString = replace(theString,"]","[]]")
fixSQL = theString
end function
sql = "SELECT * FROM immobili WHERE 1 = 1 "
if len(tipologia) > 0 then sql = sql & "AND tipologia = '" & fixSQL(tipologia) & "' "
if len(sottotipologia) > 0 then sql = sql & "AND sottotipologia = '" & fixSQL(sottotipologia) & "' "
if len(regione) > 0 then sql = sql & "AND regione = '" & fixSQL(regione) & "' "
if len(provincia) > 0 then sql = sql & "AND provincia = '" & fixSQL(provincia) & "' "
if len(comune) > 0 then sql = sql & "AND comune = '" & fixSQL(comune) & "' "
sql = sql & "ORDER BY [ID]"
set conn = server.createObject("ADODB.Connection")
conn.open connString
set rs = server.createObject("ADODB.Recordset")
rs.open sql, conn, 3, 1
if not rs.eof then
rs.pageSize = risultatiPerPagina
if rs.pageCount > pagina then pagina = 1
rs.absolutePage = pagina
response.write "Totale: " & rs.recordCount
response.write "Pagine: "
for p = 1 to rs.pageCount
if p = pagina then
response.write p & " "
else
response.write "" & p & " "
end if
next
for r = 0 to risultatiPerPagina
if not rs.eof then
' QUI MOSTRI I DATI PRESI DALLA TABELLA DEL DB
rs.moveNext
else
exit for
end if
next
response.write "Pagine: "
for p = 1 to rs.pageCount
if p = pagina then
response.write p & " "
else
response.write "" & p & " "
end if
next
end if
rs.close
set rs = nothing
conn.close
set conn = nothing
%>
Nella form, nelle combo, le option che non passano alcun valore o hanno come etichetta Tutti, devono avere value=""