Visualizzazione dei risultati da 1 a 7 su 7
  1. #1

    Problemi con multi checkbox

    ciao a tutti!
    ho questo problema ho un multi checkbox che in base a quello che seleziono o no mi deve mostrare i risultati ... allora ecco il codice checkbox

    Codice PHP:
    <%urlpagina=request.serverVariables("url")
    if 
    request.querystring<>"" then urlpagina=urlpagina "?" request.querystring
    response
    .write urlpagina
    %>
    <
    form method="post" action="../selezionastruttura.asp">

    <
    input type="hidden" name="urlpagina" value="<%= urlpagina %>">
    <%
    struttura=Request.querystring("tipos")
    if 
    struttura "" then
    struttura
    =("2,13,14,23,19,21,3")
    else
    struttura struttura
    end 
    if
    %>
    <
    input <%If InStr(struttura"2") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="2"Appartamento</td>
    <
    input <%If InStr(struttura"13") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="13"Ostello</td>
     <
    input <%If InStr(struttura"14") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="14">Albergo</td>
    <
    input <%If InStr(struttura"23") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="23">Residence
    </td>
    <
    input class="red"  type="submit" value="[ Filtra ]"></td>
    <
    input <%If InStr(struttura"19") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="19">Motel</td>
        <
    td align="left"><input <%If InStr(struttura"21") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="21">Complesso</td>
        <
    td align="left" colspan="2"><input <%If InStr(struttura"3") > 0 Then response.write ("checked='checked'")%>  type="checkbox" name="struttura" value="3">Altre strutture ricettive 
    pagina selezionastruttura.asp
    Codice PHP:
    <%@ Language "VBScript" %>
    <%
    dim tipistruttura
    tipistruttura
    =Request.Form("struttura")
    vai_aRequest.Form("urlpagina")
    tipistruttura=Replace(tipistruttura," ","")

    Response.Redirect (vai_a&"?tipos="&tipistruttura)
    %> 
    ecco il/i problemi:
    apro la pagina prova.asp digitando url nel browser tutto ok tutti i campi sono fleggati
    può essere che io desideri cambiare la lingua ecco che la mia pagina diventa
    prova.asp?lang=en
    desidero cambiare ordine la mia pagina diventa
    prova.asp?lang=en&order=1
    ora desidero togliere alcuni flag ecco l'errore ovvio perchè la mia pagina diventerà
    prova.asp?lang=en&order=1?tops=3,21
    può essere che io rimetta i flag ecco che la mia pagina diventa
    prova.asp?lang=en&order=1?tops=3,21?tops=19

    insomma un po' di casino .. vorrei risolvere qusti piccoli bug ..qualche consiglio

  2. #2
    ho fatto questa modifica .. e funziona .. può andare come logica o potrei incontrare problemi?

    Codice PHP:
    <%@ Language "VBScript" %>
    <%
    dim tipistruttura
    tipistruttura
    =Request.Form("struttura")
    vai_aRequest.Form("urlpagina")
    tipistruttura=Replace(tipistruttura," ","")

    if 
    InStr(vai_a"?") > 0 Then
    Response
    .Redirect (vai_a&"&tipos="&tipistruttura)
    else
    Response.Redirect (vai_a&"?tipos="&tipistruttura)
    end if
    %> 
    ora devo risolvere il fatto che se seleziono o deseleziono più volte i box devo evitare la ripetizione di tops=
    esrova.asp?lang=en&order=1?tops=3,21?tops=19

    quindi ogni volta che mando in esecuzione la pagina devo togliere da vai_a la parte tops=3,1 ecc.. non so se mi sono spiegato... :master:

  3. #3
    ho risolto così:

    Codice PHP:
    <%@ Language "VBScript" %>
    <%
    dim tipistruttura
    tipistruttura
    =Request.Form("struttura")
    vai_aRequest.Form("urlpagina")
    tipistruttura=Replace(tipistruttura," ","")

    ' Splitta la stringa al simbolo / 
    strURL=vai_a
    strPath = Split(strURL, "&t") 
    vai_a= strPath(Lbound(strPath))

    if InStr(vai_a, "?") > 0 Then
    Response.Redirect (vai_a&"&tipos="&tipistruttura)
    else
    Response.Redirect (vai_a&"?tipos="&tipistruttura)
    end if
    %> 
    consiglio ho fatto un ragionamento logico oppure posso incontrare problemi?

  4. #4
    altro problema così:
    If InStr(struttura, "13") > 0 ecc..

    verifico se c'è il numero 13 dentro a struttura però la condizione mi risulta > 0 anche se passo solamente il numero 3 come posso ovviare a ciò

  5. #5
    bahh. no riesco a capire allora io pass oquesto paramtro:

    /pagina.asp?tipos=19,21,3

    lui mi dovrebbe far vedere:
    Codice PHP:
        <td align="left"><input <%If InStr(struttura,"19") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="19"Motel</td>
        <
    td align="left"><input <%If InStr(struttura,"21") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="21"Complesso</td>
        <
    td align="left" colspan="2"><input <%If InStr(struttura,"3") > 0 Then response.write ("checked='checked'")%>  type="checkbox" name="struttura" value="3"
    invece mi mostra:
    Codice PHP:
    <input <%If InStr(struttura,"2") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="2"Appartamento</td>
        <
    td align="left"><input <%If InStr(struttura,"19") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="19"Motel</td>
        <
    td align="left"><input <%If InStr(struttura,"21") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="21"Complesso</td>
        <
    td align="left" colspan="2"><input <%If InStr(struttura,"3") > 0 Then response.write ("checked='checked'")%>  type="checkbox" name="struttura" value="3"
    il tutto si risolve se scrivo :
    Codice PHP:
    <input <%If InStr(struttura,"2 ") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="2"
    cio mettendo uno spazio dopo il 2 come potrei risolvere evitando il problema spazio??

  6. #6

  7. #7
    per chi avesse il mio stesso problema ho risolto così anche se non so se sia la migliore soluzione ...

    Codice PHP:
    <%
    struttura=Request.querystring("tipos")
    if 
    struttura "" then
    struttura
    =(",2,13,14,23,19,21,3,")
    else
    struttura = (","&struttura&",")
    end if
    %> 
    Codice PHP:
    <input <%If InStr(struttura,",2,") > 0 Then response.write ("checked='checked'")%> type="checkbox" name="struttura" value="2"
    praticamente ho messo tutt i numeri tra le , e poi con instr controllo ,numero, :ignore:

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.