ho questo form es:
il mio database .mdb lo creo con un unica tabella tipo: "Offerte" e poi i nomi campo all interno della tabella li creo: "tipo" "Appartamento" "Villa/Case" e così via fino a "Primo bacino" o come?codice:<form action="results.asp" method="post" name="cerca" id="cerca" style="width: 135px; padding: 0px; margin: 0px auto;"> Tipologia <select name="tipo" > <option value="tipo">Tutti i tipi</option> <option value="Appartamento">Appartamento</option> <option value="Villa/Case">Villa/Case</option> <option value="Rustici">Rustici</option> <option value="Villa di prestigio">Villa di prestigio</option> </select> </p> Prezzo <select name="CostoLire" > <option value="CostoLire">Tutti i prezzi</option> <option value="Fino a 120.000 euro">Fino a 120.000 euro</option> <option value="Da 120.000 a 200.000">Da 120.000 a 200.000</option> <option value="Da 200.000 a 300.000">Da 200.000 a 300.000</option> <option value="Da 300.000 a 500.000">Da 300.000 a 500.000</option> <option value="Oltre 500.000">Oltre 500.000</option> </select> </p> Zona geografica: <select name="zona" > <option value="zona">Tutte le zone</option> <option value="Da Gravedona a Sorico">Da Gravedona a Sorico</option> <option value="Da Consiglio a Pianello">Da Consiglio a Pianello</option> <option value="Da Pianello a Menaggio">Da Pianello a Menaggio</option> <option value="Tremezzina">Tremezzina</option> <option value="Primo bacino">Primo bacino</option> </select> </p> <label> <input name="Submit" type="submit" class="submit" value="Cerca Immobile" /> </label> </p> </form>
poi nella pagina "results.asp" inserisco:
così dovrebbe funzionare la ricerca?codice:<% response.buffer=true %> <% Server.ScriptTimeout = 300 %> <TABLE WIDTH="500" CELLPADDING="0" CELLSPACING="0" BORDER="0" align="center"> <TR height="60" valign="justify"> <TD align="justify"> <font face="verdana" size="2" color="#333333">Links partners.</font><font face="verdana" size="2" color="#333333">Segnala sito</font> </TD> <TR> <TD> <% iPageSize = 10 'NUMERO RECORD PER PAGINA If Request.QueryString("page") = "" Then iPageCurrent = 1 Else iPageCurrent = CInt(Request.QueryString("page")) End If strSQL = "SELECT * FROM Offerte ORDER BY tipo ASC" Set objRS = Server.CreateObject("ADODB.Recordset") objRS.PageSize = iPageSize objRS.CacheSize = iPageSize objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText reccount = objRS.recordcount iPageCount = objRS.PageCount If iPageCurrent > iPageCount Then iPageCurrent = iPageCount If iPageCurrent < 1 Then iPageCurrent = 1 If iPageCount = 0 Then Response.Write " Non sono stati trovati links.</p>" Else objRS.AbsolutePage = iPageCurrent iRecordsShown = 0 %> <table width="480" align="center" border="1" cellspacing="1" cellpadding="3"> <% 'SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL 'ALL'INTERNO DELLA TABELLA PRIMA DEFINITA cont=1 Do While iRecordsShown < iPageSize And Not objRS.EOF Dim Rig, bg Rig = Rig + 1 If Rig Mod 2 = 0 then bg = "#E4E4E4" Else bg = "#ccccff" End if %> <tr bgcolor="<%=Tabella_Colore_Titolo%>" align="left"> <th colspan="2" scope="col"><span class="Stile2"> <% Response.Write " " & objRS("Titolo") & "" %></span></th> </tr> <tr> <th width="80" scope="row"><% Response.Write "[img][/img]" %></th> <td width="379" valign="top"><% Response.Write "" & objRS("Testo") & "" %></td> </tr> <% Cont = Cont + 1 'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB iRecordsShown = iRecordsShown + 1 objRS.MoveNext Loop 'PULIZIA DEGLI OGGETTI ADO objRS.Close Set objRS = Nothing %> </table> <%End if%> <%If ipagecount <> 1 Then%> <center> <table> <tr valign="middle"> <td width="50%" align="center" valign="middle"><font face="verdana" size="1" color="#000000"> <center>[ <%if iPageCurrent-2 > 0 and iPageCurrent > 2 then%> Prima <%end if%> <%if iPageCurrent > 1 then%> Precedente <%end if%> <%if iPageCount > 2 then if iPageCurrent-2 < 1 then da_pag = 1 else da_pag = iPageCurrent-2 if iPageCurrent+2 > iPageCount then fino_a_pag = iPageCount else fino_a_pag = iPageCurrent+2 else da_pag = 1 fino_a_pag = iPageCount end if%> <%for i = da_pag to fino_a_pag%> <%if i = iPageCurrent then%> <font color="red"><%=i%></font> <%else%> <%=i%> <%end if%> <%next%> <%if iPageCurrent > 0 and iPageCurrent < iPageCount then%> Successiva <%end if%> <%if iPageCurrent+1 < iPageCount then%> Ultima <%end if%> ]</center> </font></td> </tr> <tr> <td colspan="2" align="center"><font face="verdana" size="0.5" color="#333333"> <center> Pagina <font color="#FF0000"><%=iPageCurrent%></font> di <font color="#FF0000"><%=iPageCount%></font> </center> </font></td> </tr> </table> </center> <%end if%> <% objConn.Close Set objConn = Nothing %> </TD> </TR> </TABLE>

Rispondi quotando