il tag code
allora nella pagina col form inserisci solo i campi di input, in questo modo
codice:
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Inserire
un prezzo minimo ed un prezzo massimo
Prezzo minimo
Euro
<INPUT maxLength=10
size=10 name=minimo
width="5%">
Prezzo max
Euro
<INPUT maxLength=10
size=10 name=massimo>
</font>
</td>
nella pagina prodotti.asp aggiungi le parti in grassetto
codice:
pag=request.Querystring("pag")
TipoProdotto=request.querystring("tipoprodotto")
Produttore=request.QueryString("produttore")
minimo=request.QueryString("minimo")
massimo=request.QueryString("massimo)
BIO=request.QueryString("BIO")
dimpag=12
if isnull(pag) or pag="" then
pag=1
else
pag=Cint(TRIM(pag))
end if
if TipoProdotto="X" then
'la 1 volta �= X x via della pag. ricercaprodotti le pag. successive �di nuovo = X
'x via del querystring
' prendo i parametri da response.form , se sono vuoti allor li prendo da session
' non salvo la sqlstr in un session x non trovarmi eventuali session di ricerche precedenti
' salvando i response.form dei vari parametri son sicuro di avere sempre quelli giusti
' non carico nemmeno prima da session xch�potrei avere dati sporchi
idStato=request.form("Stato")
dsProduttore=request.form("produttore")
TipoProdottoRicerca=request.form("catcomm")
Novita=request.form("novita")
Codice=replace(request.form("codice"),"'","''")
Descrizione=replace(request.form("descrizione"),"'","''")
Foto=request.Form("foto")
if idstato="tutti" then idstato=""
if dsproduttore="tutti" then dsproduttore=""
if tipoprodottoricerca="tutti" then tipoprodottoricerca=""
'Se tutti i parametri son vuoti allora sono nella pag. > 1 della ric avanzata
'quindi ho i valori salvati su session
if idstato="" and dsproduttore="" and tipoprodottoricerca="" and novita="" and codice="" and foto="" and descrizione="" then
'prendo da session
idstato=Session("idstato")
dsproduttore=session("dsproduttore")
tipoprodottoricerca=session("tipoprodottoricerca")
novita=session("novita")
codice=session("codice")
foto=session("foto")
descrizione=session("descrizione")
else
'salvo su session
session("idstato")=idstato
session("dsproduttore")=dsproduttore
session("tipoprodottoricerca")=tipoprodottoricerca
session("novita")=novita
session("codice")=codice
session("foto")=foto
session("descrizione")=descrizione
end if
'Sto facendo una ricerca avanzata
sqlstr=" SELECT codice,descrizione,prezzo,disponibile,confezione FROM PRODOTTI" & _
" where idStato like '" & idStato & "%'" & _
" and dsProduttore like '" & dsProduttore & "%'" & _
" and TipoProdotto like '" & TipoProdottoRicerca & "%'" & _
" and codice like '" & Codice & "%'" & _
" and descrizione like '" & descrizione & "%'"
if novita="1" then sqlstr=sqlstr & " and nuovo "
if foto="1" then sqlstr=sqlstr & " and foto "
if minimo<>"" and IsNumeric(minimo) then
sqlstr=sqlstr & " and minimo>=" & minimo
end if
if massimo<>"" and IsNumeric(massimo) then
sqlstr=sqlstr & " and massimo<=" & massimo
end if
else
if tipoprodotto<>"" and produttore="" then
'Vuol dire che sto facendo una ricerca SOLO x cat.commerciale
sqlstr=" SELECT codice,descrizione,prezzo,disponibile,confezione FROM PRODOTTI" & _
" where idtipoprodotto in (" & TipoProdotto & ") "
if bio="1" then
sqlstr=sqlstr & " and bio"
elseif bio="0" then
sqlstr=sqlstr & " and not bio"
end if
if minimo<>"" and IsNumeric(minimo) then
sqlstr=sqlstr & " and minimo>=" & minimo
end if
if massimo<>"" and IsNumeric(massimo) then
sqlstr=sqlstr & " and massimo<=" & massimo
end if
sqlstr=sqlstr & " ORDER BY idtipoprodotto, CODICE"
elseif tipoprodotto<>"" and produttore<>"" then
'Vuol dire che sto facendo una ricerca x cat.commerciale e produttore
sqlstr=" SELECT codice,descrizione,prezzo,disponibile,confezione FROM PRODOTTI" & _
" where idtipoprodotto in (" & TipoProdotto & ") and codproduttore in (" & produttore & ") "
if bio="1" then
sqlstr=sqlstr & " and bio"
elseif bio="0" then
sqlstr=sqlstr & " and not bio"
end if
if minimo<>"" and IsNumeric(minimo) then
sqlstr=sqlstr & " and minimo>=" & minimo
end if
if massimo<>"" and IsNumeric(massimo) then
sqlstr=sqlstr & " and massimo<=" & massimo
end if
sqlstr=sqlstr & " ORDER BY idtipoprodotto, CODICE"
elseif tipoprodotto="" and produttore<>"" then
'Vuol dire che sto facendo una ricerca SOLO x produttore
sqlstr=" SELECT codice,descrizione,prezzo,disponibile,confezione FROM PRODOTTI" & _
" where codproduttore in (" & produttore & ") "
if bio="1" then
sqlstr=sqlstr & " and bio"
elseif bio="0" then
sqlstr=sqlstr & " and not bio"
end if
if minimo<>"" and IsNumeric(minimo) then
sqlstr=sqlstr & " and minimo>=" & minimo
end if
if massimo<>"" and IsNumeric(massimo) then
sqlstr=sqlstr & " and massimo<=" & massimo
end if
sqlstr=sqlstr & " ORDER BY idtipoprodotto, CODICE"
end if
end if
openConnectionArticoli
set rs=server.createobject("ADODB.Recordset")
'response.Write(sqlstr)
rs.open sqlstr,ObjConn,3,3
nr=0
if not rs.eof then
rs.movelast
nr=rs.recordcount
rs.pagesize=dimpag
pagine=rs.pagecount
rs.movefirst
end if
if nr<0 then nr=0