Naturalmente da adattare alle tue esigenze:
codice:
<html>
<head><title>Filtro per Cabina Primaria</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options.value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<form name="selezione" method="post" action="">
<p style="margin-top: 0; margin-bottom: 0"></p>
<div align="left">
<%
pagina = request.servervariables("path_info")
ID_CAT = request.querystring("ID_CAT")
if len(ID_CAT) > 0 and isnumeric(ID_CAT) then
id = clng(ID_CAT)
else
id = 0
end if
set conn = server.createobject("adodb.connection")
conn.open "DRIVER={Microsoft Access Driver (*.mdb)};" &_
"DBQ="& Server.MapPath("upload.mdb")
sql = "select * from CAT order by CAT"
set rs = conn.execute(sql)
Function ConvertiData(data)
giorno = Mid(data, InStr(1, data, "/") + 1, InStrRev(data, "/") - InStr(1, data, "/") - 1)
mese = Left(data, InStr(1, data, "/") - 1)
anno = Right(data, Len(data) - InStrRev(data, "/"))
ConvertiData = giorno & "/" & mese & "/" & anno
End Function
if not rs.eof then
%>
</div>
<p style="margin-top: 0; margin-bottom: 0" align="center"></p>
<p style="margin-top: 0; margin-bottom: 0" align="left">
<select name="tabella1" onChange="jumpMenu('parent',this,0)">
<option value="<%=pagina%>?id_cat=0">Seleziona la Cabina...</option>
<% do until rs.eof %>
<option value="<%=pagina%>?id_cat=<%=rs("ID_CAT")%>"<% if rs("ID_CAT") = id_cat then %> selected<% end if %>><%=rs("CAT")%></option>
<%
rs.movenext
loop
end if
%>
</select>
<%
rs.close
set rs = nothing
if ID_CAT > 0 then
sql = "select * from ListFiles where ID_CAT = " & ID_CAT
set rs = conn.execute(sql)
do while not rs.eof
DATA_PRELIEVO = ConvertiData(CStr(RS("DATA_PRELIEVO")))
%>
<h1 align="left"><%=rs("CABINA")%></h1>
<p align="left">ID: <%=rs("UploadID")%>
Data: <%=DATA_PRELIEVO%>
<%
rs.movenext
loop
'end if
rs.close
set rs = nothing
end if 'fine if id_CAT > 0 then
conn.close
set conn = nothing
%> </p>
</p>
</form>
</body>
</html>