¿Y si a la función le pasas el nombre de la variable que quieres que vaya?
Código HTML:
Ver original<select name="tipo" onchange="mostrarInfo('cod_banda', this.value)"> <!-- Opciones -->
<select name="tipo2" onchange="mostrarInfo('cod_banda2', this.value)"> <!-- Opciones -->
Código Javascript
:
Ver originalfunction mostrarInfo(variable, cod){
if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else{// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
document.getElementById("datos").innerHTML = xmlhttp.responseText;
}else{
document.getElementById("datos").innerHTML = 'Cargando...';
}
};
xmlhttp.open("POST", "conexion/cons_report.php", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(variable + "=" + cod);
}
Por eso te decía que podías pasar más parámetros para personalizar el resultado.
Saludos