<?php
//include("sql_variables.php");
//$db_conexion= mysql_connect("$sql_host", "$sql_usuario", "$sql_pass") or die(header ("No Disponible Servidor de Base de Datos"));
//mysql_select_db("$sql_db");
//$iddepa=$_GET['departamento'];
//$idserv=$_GET['servicio'];
//$anno=$_GET['anno'];
//$mm=$_GET['mes'];
?>
<html>
<head>
<title>CREA TURNO</title>
<link rel="stylesheet" type="text/css" href="../styles/Style.css">
<script language="JavaScript" type="text/javascript" src="ajax.js"></script>
<script language="JavaScript">
function enviar(){
var horario= document.getElementById("horario").value;
var area= document.getElementById("tarea").value;

window.location= "validarturno.php?anno=<?php echo $anno;?>&mes=<?php echo $mm;?>&iddepa=<?php echo $iddepa;?>&idserv=<?php echo $idserv;?>&nivel=<?php echo $per;?>&idhora="+horario+"&idarea="+area;
}
function regresar(){
window.location= "programacionpersonal.php";
}
</script> 
</head>
<body>

<table>
<tr><td align="center">AREA</td><td align="center">HORARIO</td>
<td colspan="2" align="center"><input type="button" value="Crear" onClick="llenarturno()";><input type="button" value="Regresar" onClick="regresar()";></td></tr>
<tr><td align="center">
<?php
$sql = "SELECT a_id, a_desc from tb_area where ga_id='3'";
$result = mysql_query($sql);
if ($result == false){
echo 'PROVOCO UN ERROR EN LA CONSULTA';
}else{
echo "<select name='tarea' id='tarea'>";
while ($row= mysql_fetch_array($result)){
echo "<option value='".$row['a_id']."'>".$row['a_desc']."</option>";
}
echo "</select>";
}
?>
</td>
<td align="center">
<?php
$sql = "SELECT h_id, concat(date_format(h_horaini,'%k:%i %p'),' - ',date_format(h_horafin,'%k:%i %p')) as hora, h_horaturn, h_horanum from tb_horario";
$result = mysql_query($sql);
if ($result == false){
echo 'PROVOCO UN ERROR EN LA CONSULTA';
}else{
$totalMat=0;
echo "<select name='horario' id='horario'>";
while ($row= mysql_fetch_array($result)){
echo "<option value='".$row['h_id']."'>".$row['hora']."</option>";
}
echo "</select>";
}
?>
</td></tr><tr><td><?php $error = $_GET['error']; if(isset($error)){ echo $error;}?></td></tr></table>
<div id='menu'></div>
</body>
</html>