Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/05/2011, 18:12
fmo_paco
 
Fecha de Ingreso: abril-2011
Ubicación: parral
Mensajes: 16
Antigüedad: 13 años, 1 mes
Puntos: 0
Pregunta problema con etiqueta <span>

Tengo un formulario y un codigo:
Formulario:
<head>
<style type="text/css">
.style1 {
text-align: center;
}
</style>
</head>
<SCRIPT>
var tick;
function stop() {
clearTimeout(tick);
}
function simple_reloj() {
var ut=new Date();
var h,m,s;
var time=" ";
h=ut.getHours();
m=ut.getMinutes();
s=ut.getSeconds();
if(s<=9) s="0"+s;
if(m<=9) m="0"+m;
if(h<=9) h="0"+h;
time+=h+":"+m+":"+s;
document.getElementById('reloj').innerHTML=time;
tick=setTimeout("simple_reloj()",1000);
}
</SCRIPT>
<?php
require 'inicio.php';
require 'conexion.php';
include 'auth.php';
$gropid = $_REQUEST['gropid'];
$gruposql = "SELECT nombre, ap_pat, ap_mat, matricula FROM personal WHERE matricula='$gropid' ";
$result = mysql_query($gruposql) or die("Invalid query: " . mysql_error());
while ($row = mysql_fetch_array($result)) {
extract($row);
?>
<br>
<center>
<form method="post" action="datos_personal_sql.php">
<table style="width: 51%">
<tr><TD BGCOLOR="#08088A" style="width: 181px; height: 22px"><label>Id</label></td>
<TD BGCOLOR="#ddd9d3" style="width: 232px; height: 22px"><?php echo $matricula;?><Input type="hidden" name="mat" value="<?php echo $matricula;?>" />
</td>
<tr><TD BGCOLOR="#08088A" style="width: 181px; height: 22px"><label>Nombre</label></td>
<TD BGCOLOR="#ddd9d3" style="width: 232px; height: 22px"><?php echo $nombre;?><Input type="hidden" name="nom" value="<?php echo $nombre;?>" />
</td>
</tr>
<tr>
<TD BGCOLOR="#08088A" style="width: 181px"><label>Apellido Paterno</label></td>
<TD BGCOLOR="#ddd9d3" style="width: 232px"><?php echo $ap_pat;?><Input type="hidden" name="apat" value="<?php echo $ap_pat;?>" /></td>
</tr>
<tr>
<TD BGCOLOR="#08088A" style="width: 181px"><label>Apellido Materno</label></td>
<TD BGCOLOR="#ddd9d3" style="width: 232px"><?php echo $ap_mat;?><Input type="hidden" name="apmat" value="<?php echo $ap_mat;?>"/></td>
</tr><tr><TD BGCOLOR="#08088A" style="width: 181px"><label>Turno</label></td>
<TD BGCOLOR="#ddd9d3" style="width: 232px"><select name="turn"><option value="1">Matutino</option><option value="2">Vespertino</option></select></td>
</tr><tr>
<TD BGCOLOR="#08088A" style="width: 181px"><label>Fecha</label></td>
<TD BGCOLOR="#ddd9d3" style="width: 232px"><?php $hoy=date("d/m/Y"); ?><Input type="text" name="fech" value="<?php echo $hoy;?>"></td>
</tr><tr>
<TD BGCOLOR="#08088A" style="width: 181px"><label>Hora</label></td>
<TD BGCOLOR="#ddd9d3" style="width: 232px">
<body onLoad="simple_reloj();" onUnload="stop();">
<p><span id="reloj" name="relo">reloj</span>
</body>
</tr><tr>
<TD BGCOLOR="#08088A" style="width: 181px"><label>Asistencia</label></td>
<TD BGCOLOR="#ddd9d3" style="width: 232px"><input type="checkbox" name="recibido"></td>
</tr>
<tr>
<TD BGCOLOR="#ddd9d3" style="width: 181px" class="style1"><input type="submit" name="action" value="Guardar"/></td>
<td BGCOLOR="#ddd9d3" style="width: 181px" class="style1"><a href="control_personal.php"><input type="button" name="action" value="Regresar"/></a></td>
</tr>
</form>
</table>
</body>

Con este formulario jalo algunos datos de una tabla y otros datos los estoy poniendo desde este formulario como la fecha, la hora, turno y la asistencia.
Hasta hay me jala perfectamente.
cuando quiero ingresar los datos en mi base de datos es donde biene el problema, ya que no me guarda la ora en mi tabla. Este es el codigo que estoy utilizando para guardar en la tabla empleados:

<?php
error_reporting(0);
include ('conexion.php');
$matri=$_POST['mat'];
$nomb=$_POST['nom'];
$ape_pat=$_POST['apat'];
$ape_mat=$_POST['apmat'];
$tur=$_POST['turn'];
$fe=$_POST['fech'];
$rel=$_POST['relo'];
$recibo=$_POST['recibido'];

if ($matri=="" or $nomb=="" or $ape_pat=="" or $ape_mat==""){
echo '<script name="accion">alert("Faltan campos por rellenar")</script>';
echo '<script>parent.location.href="personal.php"</script>';
}
else {
$cadena="SELECT MAX(id) FROM control_personal";
$result=mysql_query($cadena);
$row=mysql_result($result,0,0);
$clave_aux = ($row + 1);
$cadena_agregar="insert into control_personal (matricula, nombre, ap_pat, ap_mat, turno, fecha, hora, asistencia) values ('$matri', '$nomb', '$ape_pat', '$ape_mat', '$tur', '$fe', '$rel', '$recibo')";
$rs_operacion=mysql_query($cadena_agregar);
echo '<script name="accion">alert("Los datos del empleado se introdujeron satisfactoriamente")</script>';
echo '<script>parent.location.href="personal.php"</script>';
}
?>

No me guarda la hora en la tabla control_personal si me pueden ayudar les agradeceria mucho.
Uno de los problemas que identifique es la etiqueta span, la cambio a input y me deja de funcionar el reloj, no se como hacerle si me pueden ayudar!!!!
Gracias!!!