Espero te sirva revisalo y me escribes aun falta mas codigo, este mismo problema tenia hace unas semanas y esto salio
Código PHP:
<?php
include('conec.php');
include ("calendario/calendario.php");
?>
<!DOCTYPE html>
<!– El encabezado !DOCTYPE html especifica que se trata de un documento HTML5 –>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
<script language="JavaScript" src="calendario/javascripts.js"></script>
<link rel="STYLESHEET" type="text/css" href="calendario/estilo.css">
<style type="text/css">
.n {
font-size: 20pt;
}
.Estilo22 {
font-size: 24pt;
}
</style>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script >
//funcion que limpia los demas campos
function LimpiarInput(destino,destino2)
{
destino.value="";
}
//funcion que llena los datos
function LlenarDatos(text,destino,destino2,destino3,destino4,destino5)
{
var datos = text.split('|'); //dividimos los datos para colocarlos en el lugar correcto
destino.value = datos[0];
destino2.value = datos[1];
destino3.value = datos[2];
destino4.value = datos[3];
destino5.value = datos[4];
}
//fucion con la cual obtenemos los datos
function obten_datos(arrastre,destino,destino2,destino3,destino4,destino5)
{
//alert("arrastre: "+arrastre+" destino: "+destino+" destino2: "+destino2+" destino3: "+destino3+" destino4: "+destino4+" destino5: "+destino5);
destino = document.getElementById(destino);
destino2 = document.getElementById(destino2);
destino3 = document.getElementById(destino3);
destino4 = document.getElementById(destino4);
destino5 = document.getElementById(destino5);
LimpiarInput(destino);
LimpiarInput(destino2);
LimpiarInput(destino3);
LimpiarInput(destino4);
LimpiarInput(destino5);
if(arrastre.options[arrastre.selectedIndex].value != 0)
{
arrastre.disabled = true;
destino.disabled = true;
destino.value = 'Cargando ....';
destino2.disabled = true;
destino2.value = 'Cargando ....';
destino3.disabled = true;
destino3.value = 'Cargando ....';
destino4.disabled = true;
destino4.value = 'Cargando ....';
destino5.disabled = true;
destino5.value = 'Cargando Dias de vacaciones ....';
$.ajax({
type: 'get',
dataType: 'text',
url: 'obtendatos.php',
data: {valor: arrastre.options[arrastre.selectedIndex].value},
success: function(text){
LlenarDatos(text,destino,destino2,destino3,destino4,destino5);
arrastre.disabled = false;
destino.disabled = false;
destino.readOnly = true;
destino2.disabled = false;
destino2.readOnly = true;
destino3.disabled = false;
destino3.readOnly = true;
destino4.disabled = false;
destino4.readOnly = true;
destino5.disabled = false;
destino5.readOnly = true;
}
});
}
}
</script>
<style type="text/css">
.Estilo22 { font-size: 36pt;
}
.n { font-size: 24pt;
}
</style>
</head>
<body>
<center>
<form id="form1" name="fcalen" method="post" action="">
<p> </p>
<table width="887" height="93" border="0">
<tr>
<td width="241" height="84" rowspan="2"> <img src="img/logo.jpg" alt="tab" width="122" height="171" /></td>
<td height="43"><div align="right">Guadalajara, Jal, a </div></td>
<td height="43"><div align="left">
<?php $dias = array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sábado");
$meses = array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
echo $dias[date('w')]." ".date('d')." de ".$meses[date('n')-1]. " del ".date('Y') ; ?>
</div>
<div align="left"></div></td>
</tr>
<tr>
<td width="414" height="21"><div align="center"><span class="Estilo22">GRUPO VEQ</span></div></td>
<td width="218"> </td>
</tr>
</table>
<p> </p>
<table width="954" border="0">
<tr>
<td colspan="7" align="center"><span class="n">FORMATO DE VACACIONES </span></td>
</tr>
<tr>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td> </td>
<td width="190"> </td>
<td width="181"> </td>
</tr>
<tr>
<td width="49" height="32"> </td>
<td width="110">Trabajador :</td>
<td width="287" colspan="2"><table width="27%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="38%"> </td>
<td width="62%"><label>
<select name="name" id="name" onchange="javascipt:obten_datos(this,'nombre','apaterno','amaterno','puesto','rfc');">
<option value="0"> :: Elije El Nombre :: </option>
<?php
// creamos las opciones del select
$sql = new conectarMySQL("localhost", "root", "", "veq_rh");
$sql->conectar();
$sql->consultar("SELECT numero, nombre FROM personal");
while ($row = $sql->obtendatos()){
?>
<option value="<?php echo $row['numero']; ?>"> <?php echo $row['nombre'];?></option>
<?php
}
$sql->cerrarconexion();
$sql->limpiaconsulta();
?>
</select>
</label></td>
</tr>
</table></td>
<td width="111"> </td>
<td>Fecha de Entrada :</td>
<td><input type="text" name="amaterno" id="amaterno" /></td>
</tr>
<tr>
<td> </td>
<td>Area :</td>
<td colspan="2"><input type="text" name="nombre" id="nombre" /></td>
<td> </td>
<td>Años de Servicio :</td>
<td><input name="puesto" type="text" id="puesto" size="4" /></td>
</tr>
<tr>
<td> </td>
<td>Puesto : </td>
<td colspan="2"><input type="text" name="apaterno" id="apaterno" /></td>
<td> </td>
<td>Dias de vacaciones por Disfrutar : </td>
<td><input name="rfc" type="text" id="rfc" size="4" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2" align="left"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align="left"> </td>
<td align="left"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2" align="left"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p>
<p><br />
</p>
</form>
<br />
</center>
</body>
</html>
obtendatos.php
Código PHP:
include('conec.php');
$valor = $_GET['valor'];
$sql2 = new conectarMySQL("localhost", "root", "", "veq_rh");
$sql2->conectar();
$sql2->consultar("SELECT * FROM personal WHERE numero = '$valor' ");
$row = $sql2->obtendatos();
echo $row['area'].'|'.$row['puesto'].'|'.$row['fecha'].'|'.$row['anos'].'|'.$row['dias_por_disf'];
sleep(1);
return $dat = $row['area'].$row['puesto'].'|'.$row['fecha'].'|'.$row['anos'].'|'.$row['dias_por_disf'];
$sql2->cerrarconexion();
$sql2->limpiaconsulta();