Código PHP:
<?php require_once('Connections/cfl.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "asistencia")) {
$insertSQL = sprintf("INSERT INTO asistencia (fecha, asisten, id_personal) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['fecha'], "text"),
GetSQLValueString($_POST['asisten'], "text"),
GetSQLValueString($_POST['id_personal'], "text"));
mysql_select_db($database_cfl, $cfl);
$Result1 = mysql_query($insertSQL, $cfl) or die(mysql_error());
}
$maxRows_personal = 10;
$pageNum_personal = 0;
if (isset($_GET['pageNum_personal'])) {
$pageNum_personal = $_GET['pageNum_personal'];
}
$startRow_personal = $pageNum_personal * $maxRows_personal;
mysql_select_db($database_cfl, $cfl);
$query_personal = "SELECT * FROM personal";
$query_limit_personal = sprintf("%s LIMIT %d, %d", $query_personal, $startRow_personal, $maxRows_personal);
$personal = mysql_query($query_limit_personal, $cfl) or die(mysql_error());
$row_personal = mysql_fetch_assoc($personal);
if (isset($_GET['totalRows_personal'])) {
$totalRows_personal = $_GET['totalRows_personal'];
} else {
$all_personal = mysql_query($query_personal);
$totalRows_personal = mysql_num_rows($all_personal);
}
$totalPages_personal = ceil($totalRows_personal/$maxRows_personal)-1;
?><head>
<script language='javascript' src="popcalendar.js"></script>
<title>Inicio de Actividades</title>
<style type="text/css">
<!--
.Estilo1 {font-size: 36px}
body {
background-color: #000000;
}
.Estilo6 {font-size: 11px; font-style: italic; }
.Estilo7 {font-size: 12px; font-style: italic; }
.Estilo8 {font-size: 12px}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<center>
<table width="949" border="0" align="center" bgcolor="#FFFFFF">
<tr>
<td><table width="100%" border="0">
<tr>
<td width="286"><img src="imagenes/logo cfl.JPG" width="391" height="195" /></td>
<td><div align="center"><span class="Estilo1">Terrazas de Huechuraba </span></div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="326" valign="top"><table width="369" border="0">
<tr>
<td width="52"><a href="index.php">Inicio</a></td>
<td width="150"><a href="cactividades.php">Cese de actividades </a></td>
<td width="153"><a href="resumenpersonal.php">Resumen de personal </a></td>
</tr>
</table>
<p> </p>
<form action="<?php echo $editFormAction; ?>" method="POST" name="asistencia" id="asistencia">
<table width="90%" align="center" cellpadding="0" cellspacing="0">
<col width="27" />
<col width="142" />
<col width="80" span="2" />
<col width="85" />
<tr height="18">
<td width="144">PATERNO</td>
<td width="132">NOMBRES</td>
<td width="99">RUT</td>
<td width="113">CARGO</td>
<td width="129">F,ING<span class="Estilo6">
<input name="fecha" type="hidden" id="fecha" value="<script languaje="JavaScript"> ">
</span></td>
<td width="230"><script languaje="JavaScript">
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
document.write("<small><font color='000000' face='Arial'>"+dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year+"</font></small>")
</script> </td>
</tr>
<?php do { ?>
<tr height="18">
<td height="19" align="right"><div align="left" class="Estilo7"><?php echo $row_personal['apellidos']; ?>
<input name="id_personal" type="hidden" id="id_personal" value="<?php echo $row_personal['id']; ?>">
</div></td>
<td height="18"><span class="Estilo7"><?php echo $row_personal['nombres']; ?></span></td>
<td height="18"><span class="Estilo7"><?php echo $row_personal['rut']; ?></span></td>
<td height="18" align="right"><div align="left" class="Estilo7"><?php echo $row_personal['labor']; ?></div></td>
<td height="18" align="right"><div align="left" class="Estilo7"><?php echo $row_personal['fingreso']; ?></div></td>
<td align="center"><span class="Estilo8">
<label>
</span>
<div align="center" class="Estilo8">
<input name="asisten" type="text" id="asisten" size="10">
</div>
<span class="Estilo8">
</label>
</span></td>
</tr>
<?php } while ($row_personal = mysql_fetch_assoc($personal)); ?>
</table>
<input type="hidden" name="MM_insert" value="asistencia">
<label>
<input type="submit" name="Submit" value="Enviar">
</label>
</form>
<p> </p></td>
</tr>
</table>
</center>
<?php
mysql_free_result($personal);
?>