tengo el siguiente código, que es donde guardo mis variables del formulario
Código PHP:
for($i=0;$i<=$_SESSION['cuenta_seg']-1;$i++){
$_SESSION['segmento'][$i]=$_POST['segmento'.$i];
$_SESSION['metodo'][$i]=$_POST['metodo'.$i];
$_SESSION['hora'][$i]=$_POST['hora'.$i];
$_SESSION['hora_actual']=$_POST['hora_hi'];
}
Código PHP:
<table border="1">
<tr>
<td>Segmento Trabajado</td>
<td>Método</td>
<td>Hora</td>
</tr>
<?php
for($r=0;$r<=$_SESSION['cuenta_seg'];$r++){
echo"<tr>";
echo "<td><input style='border:none' type='text' name='segmento".$r."' id='segmentos".$r."' value='".$_SESSION['segmento'][$r]."' ></td>";
echo "<td><input style='border:none' type='text' name='metodo".$r."' id='metodo".$r."' value='".$_SESSION['metodo'][$r]."' ></td>";
echo "<td><input style='border:none' type='text' name='hora".$r."' id='hora".$r."' value='".$_SESSIOM['hora']."'></td>";
echo "</tr>";
}
?>
</table>
Código PHP:
echo "<td><input style='border:none' type='text' name='hora".$r."' id='hora".$r."' value='".$_SESSIOM['hora']."'></td>";
lo que logro hacer es que me ponga la misma hora en todos los campos pero quiero horas diferentes en cada uno aunque sea con diferencia de 1 segundo
les adjunto todo el codigo para que no quede duda
Código PHP:
<?php
session_start();
if(!isset($_SESSION['cuenta_seg'])){
$_SESSION['cuenta_seg']=0;
}
else{
$_SESSION['cuenta_seg']=$_SESSION['cuenta_seg']+1;
}
$dia3= $_SESSION['dia2'];
$mes1 = $_SESSION['mes'];
$ano1= $_SESSION['ano'];
if($action==2){
for($i=0;$i<=$_SESSION['cuenta_seg']-1;$i++){
$_SESSION['segmento'][$i]=$_POST['segmento'.$i];
$_SESSION['metodo'][$i]=$_POST['metodo'.$i];
$_SESSION['hora'][$i]=$_POST['hora'.$i];
$_SESSION['hora_actual']=$_POST['hora_hi'];
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>..::Tratamientos::..</title>
<style type="text/css">
#contenedor {
width: 700px;
}
#cabecera {
}
#menu {
float: left;
width: 150px;
}
#contenido {
float: left;
width: 550px;
}
#pie {
clear: both;
}
#pie1{
float:left
width:100px;
}
#pie2{
float:left;
width:210px;
}
#pie3 {
float:none;
width: 220px;
}
label {
display: block;
margin: .5em 0 0 0;
}
.btn {
display: block;
margin: 1em 0;
}
#lista{
background-color:#333; color:#000000;
}
.resaltado
{
background-color:#FFFFFF; color:#000000;
cursor:pointer;
}
</style>
</head>
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="combo.js"></script>
<body onload="asignaVariables();">
<div id="contenedor">
<div id="cabecera">
titulo
</div>
<div id="menu">
<object id="fm_menu_menu_administrador" width="140px" height="216px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">
<param name="movie" value="menu_administrador.swf" /><param name="quality" value="high" />
<param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" />
<param name="scale" value="noscale" /><param name="salign" value="LT" /><param name="menu" value="false" />
<embed type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"
width="140px" height="216px" bgcolor="#000000" wmode="transparent" src="menu_administrador.swf"
quality="high" scale="noscale" menu="false" salign="LT" />
</object>
</div>
<div id="contenido">
<form action="index.php?action=2" method="post">
<fieldset>
<legend>Tratamientos</legend>
<label >Fecha</label>
<input readonly="readonly" type="text" name="fecha" value="<?php echo "$dia3 de $mes1 de $ano1"; ?>"/>
<label>Atendio</label>
<input type="text" readonly="readonly" name="atendio" value="<?php echo $_SESSION['nombre']." ".$_SESSION['app_p']." ".$_SESSION['app_m']?>" size="50" />
<label>Nombre del Cliente</label>
<table>
<tr>
<td>
<div>
<div><input type="text" name="nombre1" id="input_2" class="input"
onfocus="if(document.getElementById('lista').childNodes[0]!=null && this.value!='') { filtraLista(this.value); formateaLista(this.value);
reiniciaSeleccion(); document.getElementById('lista').style.display='block'; }"
onblur="cargacombo('input_2','servicontra') "
onkeyup="if(navegaTeclado(event)==1) {
clearTimeout(ultimoIdentificador);
ultimoIdentificador=setTimeout('rellenaLista()', 1000); }">
</div>
<div id="lista" onmouseout="v=1;" onmouseover="v=0;"></div>
</div></td>
</tr>
<tr>
</tr>
</table>
<label>Servicios contratados</label>
<div id="serv">
<select id="servicontra" name="servicontra">
<option>Elige...</option>
</select>
</div>
<label>Numero de Visita</label>
<input type="text" id="visita" name="visita" readonly="readonly" />
<br /> <br />
<table border="1">
<tr>
<td>Segmento Trabajado</td>
<td>Método</td>
<td>Hora</td>
</tr>
<?php
for($r=0;$r<=$_SESSION['cuenta_seg'];$r++){
echo"<tr>";
echo "<td><input style='border:none' type='text' name='segmento".$r."' id='segmentos".$r."' value='".$_SESSION['segmento'][$r]."' ></td>";
echo "<td><input style='border:none' type='text' name='metodo".$r."' id='metodo".$r."' value='".$_SESSION['metodo'][$r]."' ></td>";
echo "<td><input style='border:none' type='text' name='hora".$r."' id='hora".$r."' value='".$_SESSIOM['']."'></td>";
echo "</tr>";
}
?>
</table>
</select>
<input type="hidden" name="hora_hi" id="hora_hi" value="<?php echo date("H:i:s") ?>" />
<input class="btn" type="submit" value="Aceptar" />
<input class="btn" type="reset" value="Limpiar" />
</fieldset>
</form>
</div>
<div id="pie">
<table>
<tr>
<td>
<?php
$dia=date("l");
if ($dia=="Monday") $dia="Lunes";
if ($dia=="Tuesday") $dia="Martes";
if ($dia=="Wednesday") $dia="Miércoles";
if ($dia=="Thursday") $dia="Jueves";
if ($dia=="Friday") $dia="Viernes";
if ($dia=="Saturday") $dia="Sabado";
if ($dia=="Sunday") $dia="Domingo";
// Obtenemos el número del día
$dia2=date("d");
// Obtenemos y traducimos el nombre del mes
$mes=date("F");
if ($mes=="January") $mes="Enero";
if ($mes=="February") $mes="Febrero";
if ($mes=="March") $mes="Marzo";
if ($mes=="April") $mes="Abril";
if ($mes=="May") $mes="Mayo";
if ($mes=="June") $mes="Junio";
if ($mes=="July") $mes="Julio";
if ($mes=="August") $mes="Agosto";
if ($mes=="September") $mes="Setiembre";
if ($mes=="October") $mes="Octubre";
if ($mes=="November") $mes="Noviembre";
if ($mes=="December") $mes="Diciembre";
// Obtenemos el año
$ano=date("Y");
// Imprimimos la fecha completa
echo "$dia $dia2 de $mes de $ano"; ?>
</td>
<td> </td>
<td>
<?php echo $_SESSION['perfil'].": ". $_SESSION['nombre']." ".$_SESSION['app_p']." ".$_SESSION['app_m'] ?> <a href="http://www.forosdelweb.com/f18/extras/logout.php"><img src="http://www.forosdelweb.com/f18/imagenes/botonapagar.jpg" alt="Salir" title="Cerrar Sesion"/></a>
</td>
<td> </td>
<td>
© Derechos Reservados
</td>
</tr>
</table>
</div>
</div>
</body>
</body>
</html>