Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/07/2011, 07:53
Avatar de fernandaYO
fernandaYO
 
Fecha de Ingreso: mayo-2011
Ubicación: Medellin
Mensajes: 166
Antigüedad: 13 años
Puntos: 4
No funcionar el codigo

Quien podria decirme, que es loq eu le falta a este codigo?
no me funciona, se supne qeu despues de seleccionar un combobox y ser enviada la iformacion, se deberia activar el otro..
pero.. no se activa.. cual sera el error? porfa Helpmeeeeeeeeeeeeee!!!

Código PHP:
<?php include "conexion.php";
?>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Muestras Bonco S.A</title>
</head>
<script>
//hacer que funcione con diferentes navegadores
function requerir(){
try{
req=new XMLHttpRequest();
}catch(err1){
try{
req=new ActiveXObject("Microsoft.XMLHTTP");
}catch(err2){
try{
req=new ActiveXObject("Msxml2.XMLHTTP");
}catch(err3){
req= false;
}
}
}
return req;
}


var peticion=requerir();

function llamarAjaxGETpro(){
var aleatorio=parseInt(Math.random()*999999999);
valor=document.getElementById("Empresa").value;
var url="fecha.php?valor="+valor+"&r="+aleatorio;
peticion.open("GET",url,true);
peticion.onreadystatechange =respuestaAjaxpro;
peticion.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
peticion.send(null);
}


function respuestaAjaxpro(){

if(peticion.readyState==4){
if(peticion.status==200){
//alert(peticion.responseText);
document.getElementById("pro").innerHTML=peticion. responseText;
}else{
alert("ha ocurrido un error"+peticion.statusText);
}
}
}

</script>

<body>
<form action="" method="post" enctype="application/x-www-form-urlencoded" name="form1" id="form1">
<div id="dep" style="width:150px; float:left">
<select name="fecha" id="fecha" onChange="llamarAjaxGETpro()">
<option>---Seleccione---</option>


<?php
$re
=mysql_query("select distinct Empresa from prueba2");
while(
$f=mysql_fetch_array($re)){

echo
'<option value="'.$f['Empresa'].'">'.$f['Empresa'].'</option>';
}
?>
</select>
</div>
<div id="pro" style="width:150px; float:left">
<select disabled="disabled">
<option>---Seleccione---</option>
</select>
</div>
</form>

</body>
</html>
y el
Fecha.php
Código PHP:

<?php

include "conexion.php";
$valor=$_GET['valor'];
$re=mysql_query("select distinct Fecha_en from prueba2 where Empresa='%$valor'% ");
echo
'<select id="fecha" onchange=llamarAjaxGETpro()>';
echo
'<option >---Seleccione---</option>';
while(
$f=mysql_fetch_array($re)){
echo
'<option value="'.$f['Fecha_en'].'">'.$f['Fecha_en'].'</option>';
}

echo
'</select>';
?>
Gracias
__________________
Umm, infraccion :(//