Ver Mensaje Individual
  #16 (permalink)  
Antiguo 08/09/2010, 15:22
patypecas
 
Fecha de Ingreso: julio-2010
Mensajes: 91
Antigüedad: 13 años, 10 meses
Puntos: 1
Respuesta: restar fechas

y el q tiene los campos se llama pago1.php.....este se devuelve al index porque todo lo hacen dentro del mismo index
Código PHP:
<? session_start();
ob_start();

include 
"../librerias/comun.php";
include 
"../librerias/d_base.php";
include 
"d_base.php";
include 
"../funciones/db_mysql.php";
$fecha date("Y-m-d");
$hora date("H:i:s");

header('Content-Type: text/xml; charset=ISO-8859-1');
echo 
'<?xml version="1.0" encoding="ISO-8859-1"?>';
$cuenta_categorias traer_fila_row(query_db("select count(*) from $com1 where compras_estado = 1 "));

$busca_categorias "select * from $com2, $com3, $com4 where $com4.compras4_session='$session_carro' and 
$com3.compras3_id = $com4.compras3_id and
$com2.compras2_id = $com3.compras2_id "
;

$sql_ex query_db($busca_categorias);

//fecha actual
date_default_timezone_set("America/Bogota");
$fechaactual date("d-m-Y");

?>

<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<script language="javascript" type="text/javascript" src="validarfecha.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>


</table>

<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td width="32%" align="center" valign="middle" class="letra_carro_TITULO"><div align="right"><img src="compras/imagenes/carro_g.gif" alt=""></div></td>
<td width="68%" align="center" valign="middle" class="letra_carro_TITULO"><div align="left"><strong>Informaci&oacute;n de Entrega</strong></div></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td><div align="right"><strong>DATOS DEL COMPRADOR</strong></div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="38%"><div align="right"><strong>Nombre:</strong></div></td>
<td width="62%"><label>
<input name="a" type="text" id="a" size="50">
</label></td>
</tr>
<tr>
<td><div align="right"><strong>No. de Documento de Identificaci&oacute;n:</strong></div></td>
<td><input name="b" type="text" id="b" size="50"></td>
</tr>
<tr>
<td><div align="right"><strong>Tel&eacute;fono:</strong></div></td>
<td><input name="g" type="text" id="g" size="50"></td>
</tr>
<tr>
<td><div align="right"><strong>E-mail:</strong></div></td>
<td><input name="h" type="text" id="h" size="50"></td>
</tr>
<tr>
<td align="right">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right"><strong>DATOS DE DESTINO</strong></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right"><strong><?php //Fecha de entrega (dd-mm-aaaa):?></strong></td>
<td><input name="fechapedido" type="hidden" id="fechapedido"  maxlength="10"></td>

</tr>
<tr>
<td align="right"><strong>Fecha y hora de entrega:</strong></td>
<td><table width="303" border="0" cellspacing="2" cellpadding="2">
<tr>
<td>A&ntilde;o</td>
<td>Mes</td>
<td>Dia</td>
<td>Hora</td>
<td>Minuto</td>
</tr>
<tr>
<td><select name="ano" id="ano">
<option value="<?=date(Y);?>">
<?=date(Y);?>
</option>
<? echo "<option value='".(date(Y)+1)."'>".(date(Y)+1)."</option>";  ?>
<? 
echo "<option value='".(date(Y)+2)."'>".(date(Y)+2)."</option>";  ?>
<? 
echo "<option value='".(date(Y)+3)."'>".(date(Y)+3)."</option>";  ?>
<? 
echo "<option value='".(date(Y)+4)."'>".(date(Y)+4)."</option>";  ?>
<? 
echo "<option value='".(date(Y)+5)."'>".(date(Y)+5)."</option>";  ?>
</select></td>
<td><select name="mes" id="mes">
<?
$mes_arreg 
= array("Mes","Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic");
for(
$i=1;$i<13;$i++)
{
if(
$i<=9$mes_im "0".$i;    else $mes_im $i;
if(
$mes_im==date(m)) $selec "selected"; else $selec="";
echo 
"<option value='".$mes_im."' ".$selec.">".$mes_arreg[$i]."</option>";
}

?>
</select></td>
<td><select name="dia_pedido" id="dia_pedido">
<?
for($i=1;$i<32;$i++){
if(
$i<=9$dia_pedido "0".$i;    else $dia_pedido $i;
if(
$dia_pedido==date(d)) $selec "selected"; else $selec="";
echo 
"<option value='".$dia_pedido."'  ".$selec.">".$dia_pedido."</option>";

}
?>
</select></td>
<td><select name="hora_pedido" id="hora_pedido">
<option value="0">Hora</option>
<?
for($i=6;$i<25;$i++){
if(
$i<=9$hora_im "0".$i;    else $hora_im $i;
if(
$hora_im==date(H)) $selec "selected"; else $selec="";
echo 
"<option value='".$hora_im."' ".$selec.">".$hora_im."</option>";


}
?>
</select></td>
<td><select name="minuto_pedido" id="minuto_pedido">
<option value="00">minuto</option>
<?
for($i=0;$i<60;$i+=5){
if(
$i<=9)
$hora_im "0".$i;
else
$hora_im $i;
echo 
"<option value='".$hora_im."'>".$hora_im."</option>";


}
?>
</select>        </td>
</tr>
</table></td>
</tr>
<tr>
<td><div align="right"><strong>Nombre:</strong></div></td>
<td><input name="nombre_destino" type="text" id="nombre_destino" size="50"></td>
</tr>
<tr>
<td><div align="right"><strong>País:</strong></div></td>
<td><input name="c" type="text" id="c" value="Colombia" size="50" readonly></td>
</tr>
<tr>
<td><div align="right"><strong>Departamento:</strong></div></td>
<td><input name="d" type="text" id="d" value="Cundinamarca" size="50"  readonly></td>
</tr>
<tr>
<td><div align="right"><strong>Ciudad:</strong></div></td>
<td><input name="e" type="text" id="e" value="Bogota D.C." size="50"  readonly></td>
</tr>
<tr>
<td><div align="right"><strong>Direcci&oacute;n (Nueva):</strong></div></td>
<td><input name="f" type="text" id="f" size="50"></td>
</tr>
<tr>
<td><div align="right"><strong>Tel&eacute;fono:</strong></div></td>
<td><input name="telefono_destino" type="text" id="telefono_destino" size="50"></td>
</tr>
<tr>
<td><div align="right"><strong>Observaciones:</strong></div></td>
<td rowspan="2"><label>
<textarea name="observa" id="observa" cols="45" rows="5"></textarea>
</label></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<input type="hidden" name="produ">
<input type="hidden" name="cantidad">

<input type="hidden" name="anoactual"  value="<?php echo $anoactual;?>" >
<input type="hidden" name="mesactual"  value="<?php echo $mesactual;?>" >
<input type="hidden" name="diaactual"  value="<?php echo $diaactual;?>" >
<input type="hidden" name="fechaactual"  value="<?php echo $fechaactual;?>">


<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td width="75%"><div align="right"></div></td>
<td width="25%"><label>
<input type="button" name="button2" id="button" value="Presione aqu&iacute; para realizar el pago" onClick="agrega_pago('<?=$fecha?>')">
</label></td>
</tr>
</table>

<?php
//Función que nos da la diferencia en días entre 2 fechas
function diferencia_fechas($fecha1,$fecha2){

$fecha1=substr($fecha1,6,4)."-".substr($fecha1,3,2)."-".substr($fecha1,0,2);
echo 
$fecha;
$fecha2=substr($fecha2,6,4)."-".substr($fecha2,3,2)."-".substr($fecha2,0,2);
$s strtotime($fecha1)-strtotime($fecha2);
$d intval($s/86400);
return  
$d;
}
?>

</body>
</html>