BOTON PARA LISTA DEPENDIENTE
Publicado por ORLANDO (73 intervenciones) el 13/01/2015 01:43:34
Muy buenas noches y muchas gracias de antemano.
Resulta que tengo unas lista/menu o box anidadas o dependientes, quiero que al elegir la segunda lista me muestre un boton o un link para mostrar cualquier información pero en la misma pagina. Como puedo hacer?
Anexo:
cita2.php
procesa_medico.php
ajax.js
Resulta que tengo unas lista/menu o box anidadas o dependientes, quiero que al elegir la segunda lista me muestre un boton o un link para mostrar cualquier información pero en la misma pagina. Como puedo hacer?
Anexo:
cita2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
include 'conexion2.php';
?>
<!DOCTYPE html>
<html>
<head>
<body bgcolor="#CCCCCC">
<script src="ajax.js"></script>
</head>
<body>
<div align="center"><font size=5 face="Comic Sans MS,arial,verdana" align="center">Cita Medica</font></div>
<div align="left"><font size=3 face="Comic Sans MS,arial,verdana" align="left">Seleccione Especialidad:</font></div>
<?php
$con=conexion();
$res=mysql_query("SELECT * FROM especialidad ORDER BY desEspecialidad ASC" ,$con);
?>
<select id="cont" onchange="load(this.value)">
<option value="">Click</option>
<?php
while($fila=mysql_fetch_array($res))
{?>
<option value="<?php echo $fila['idEspecialidad']; ?>"><?php echo $fila['desEspecialidad']; ?></option>
<?php } ?>
</select>
<div id="myDiv"></div>
</body>
</html>
procesa_medico.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html lang="es">
<title>Seleccion medico y calendario mensual</title>
<meta charset="utf-8">
<head>
</head>
<body>
<div align="left"><font size=3 face="Comic Sans MS,arial,verdana" align="left">Seleccione su Médico Tratante:</font></div>
<?php
include 'conexion2.php';
$q=$_POST['q'];
$con=conexion();
$res=mysql_query("SELECT * FROM medico_especialidad join medico WHERE medico_especialidad.cedula=medico.cedula AND medico_especialidad.idEspecialidad=".$q."",$con);
?>
<select>
<option value="">Click</option>
<?php while($fila=mysql_fetch_array($res)){
?>
<option><?php echo $fila['apellido']." ".$fila['nombre']; ?></option>
<?php }?>
<font size=3 face="Comic Sans MS,arial,verdana" align="center"><a href="horario.php?q=<?php echo $q;?>" target="popup" onclick="window.open('', 'popup', 'left=400, top=500, width = 300, height = 270, scrollbars=no, toolbar=no, resizable=no, menubar=no, directories=no, Location=no')">Ver horario de atención</font></a>
</select>
</body>
</html>
ajax.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function load(str)
{
var xmlhttp;
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("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","procesa_medico.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("q="+str);
}
Valora esta pregunta


0