io ho questo codice che funziona :
xmlhttp.open("GET", "listafilm.php?citta=a&tipo=b",true);
finchè qui metto a mano per esempio torino e film
mlhttp.open("GET", "listafilm.php?citta=torino&tipo=film",true);
funziona.
ma se scrivo a e b non mi funziona sapete perchè?
mettendo un alert vedo che a e b vengono presi come torino e film ma poi non funziona.
<?php session_start(); ?>
<?php include_once "Config/ConfigDB.php" ?>
<?php
$dbConn = mysql_connect($host, $user, $pw) or die("DBMS non disponibile");
mysql_select_db($db, $dbConn);
$query = "select * from sedi";
$rs = mysql_query($query,$dbConn) or die("Errore durante la query");
//mysql_close();
?>
<link rel="stylesheet" href="Style.css" type="text/css">
<script type="text/javascript">
function ggg(){
var xmlhttp=false;
var elemento= document.getElementById("pippo");
var a = document.modulo.citta.value;
var b = document.modulo.tipo.value;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}
alert(a + b)
xmlhttp.open("GET", "listafilm.php?citta=a&tipo=b",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
elemento.innerHTML = xmlhttp.responseText;
alert(xmlhttp.responseText)
}
}
xmlhttp.send(null)
}
</script>
<table width="100px" border="1">
<form name="modulo">
<tr><th>Città</th><th>Tipo</th></tr>
<tr><td><select name="citta" ><?php while($row = mysql_fetch_array($rs)){ ?>
<option value="<?php echo $row['citta'] ?>"><?php echo $row['citta'] ?></option>
<?php } ?></select></td>
<td><select name="tipo" >
<option value="film">film</option>
<option value="gioco">videogioco</option>
</select></td>
<input type="text" name="nome" onblur="return ggg()">
</form>
</table>
<div id="pippo">pluto</div>