Ho fatto questa pagina, dove man mano che riempo le check box appare il risultato.
Esempio:
cartacredito=1&cassettasicurezza=1&attsport=1
Come posso fare per far eseguire una query e farmi stampare i risultati in Automatico? ?
codice:
<!DOCTYPE html>
<html>
<head>
<style>
body, select { font-size:12px; }
form { margin:5px; }
p { color:red; margin:5px; font-size:14px; }
b { color:blue; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<form >
<input type="checkbox" name="disabile" value="1" id="ch1"/>
<label for="ch1">disabile</label>
<input type="checkbox" name="animale" value="1" id="ch2"/>
<label for="ch2">animale</label>
<input type="checkbox" name="condizionatore" value="1" id="ch3"/>
<label for="ch3">condizionatore</label>
<input type="checkbox" name="bagnopriv" value="1" id="ch4"/>
<label for="ch4">bagnopriv</label>
<input type="checkbox" name="fumatore" value="1" id="ch5"/>
<label for="ch5">fumatore</label>
<input type="checkbox" name="limiteora" value="1" id="ch6"/>
<label for="ch6">limiteora</label>
<input type="checkbox" name="parcheggio" value="1" id="ch7"/>
<label for="ch7">parcheggio</label>
<input type="checkbox" name="colazione" value="1" id="ch8"/>
<label for="ch8">colazione</label>
<input type="checkbox" name="coffemachine" value="1" id="ch9"/>
<label for="ch9">coffemachine</label>
<input type="checkbox" name="piscina" value="1" id="ch10"/>
<label for="ch10">piscina</label>
<input type="checkbox" name="angolocottura" value="1" id="ch11"/>
<label for="ch11">angolocottura</label>
<input type="checkbox" name="giardino" value="1" id="ch12"/>
<label for="ch12">giardino</label>
<input type="checkbox" name="tvcamera" value="1" id="ch13"/>
<label for="ch13">tvcamera</label>
<input type="checkbox" name="vasca" value="1" id="ch14"/>
<label for="ch14">vasca</label>
<input type="checkbox" name="asciugacapelli" value="1" id="ch15"/>
<label for="ch15">asciugacapelli</label>
<input type="checkbox" name="doccia" value="1" id="ch16"/>
<label for="ch16">doccia</label>
<input type="checkbox" name="idromassaggio" value="1" id="ch17"/>
<label for="ch17">idromassaggio</label>
<input type="checkbox" name="saponi" value="1" id="ch18"/>
<label for="ch18">saponi</label>
<input type="checkbox" name="letto_bambini" value="1" id="ch19"/>
<label for="ch19">letto_bambini</label>
<input type="checkbox" name="internet" value="1" id="ch20"/>
<label for="ch20">internet</label>
<input type="checkbox" name="wifi" value="1" id="ch21"/>
<label for="ch21">wifi</label>
<input type="checkbox" name="cartacredito" value="1" id="ch22"/>
<label for="ch22">cartacredito</label>
<input type="checkbox" name="paypal" value="1" id="ch23"/>
<label for="ch23">paypal</label>
<input type="checkbox" name="cassettasicurezza" value="1" id="ch24"/>
<label for="ch24">cassettasicurezza</label>
<input type="checkbox" name="pulizia_camera" value="1" id="ch25"/>
<label for="ch25">pulizia_camera</label>
<input type="checkbox" name="convenzioni_locali" value="1" id="ch26"/>
<label for="ch26">convenzioni_locali</label>
<input type="checkbox" name="attsport" value="1" id="ch27"/>
<label for="ch27">attsport</label>
<input type="checkbox" name="lavanderia" value="1" id="ch28"/>
<label for="ch28">lavanderia</label>
<input type="checkbox" name="sauna" value="1" id="ch29"/>
<label for="ch29">sauna</label>
<input type="checkbox" name="frigobar" value="1" id="ch30"/>
<label for="ch30">frigobar</label>
<input type="checkbox" name="telefono" value="1" id="ch31"/>
<label for="ch31">telefono</label>
<input type="checkbox" name="guide" value="1" id="ch32"/>
<label for="ch32">guide</label>
<input type="checkbox" name="transfert" value="1" id="ch33"/>
<label for="ch33">transfert</label>
</form>
<tt id="results"></tt></p>
<script>
function showValues() {
var str = $("form").serialize();
$("#results").text(str);
}
$(":checkbox, :radio").click(showValues);
$("select").change(showValues);
showValues();
</script>
</body>
</html>