Ver Mensaje Individual
  #6 (permalink)  
Antiguo 15/06/2005, 15:19
yokoshima
 
Fecha de Ingreso: febrero-2005
Ubicación: chile, Santiasko
Mensajes: 728
Antigüedad: 19 años, 2 meses
Puntos: 1
en pagina:
Código PHP:
function GetSelectFechaHTML($fecha=''){ //$fecha en formato YYYY-MM-DD HH:MM:SS
 
$html='';
 
$meses=array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
 if(
strlen($fecha)>=10){
  
$year=substr($fecha,0,4);
  
$mes=substr($fecha,5,2);
  
$dia=substr($fecha,8,2);
 } else {
  
$year=date("Y");
  
$mes=date("m");
  
$dia=date("d");
 }
 
$seldia='<select name="cb_dia" class="input" id="cb_dia">';
 
$selmes='<select name="cb_mes" class="input" id="cb_mes">';
 
$selano='<select name="cb_ano" class="input" id="cb_ano">';
 
$opdia='';
 
$opmes='';
 
$opano='';
 for(
$i=1;$i<=31;$i++){
   
$dd=substr("0".$i,-2);
   if(
$dd==$dia){
     
$opdia.='<option value="'.$dd.'" selected="selected">'.$dd.'</option>';
   } else {
     
$opdia.='<option value="'.$dd.'">'.$dd.'</option>';
   }
 }
 for(
$i=0;$i<12;$i++){
   
$mm=substr("0".($i+1),-2);
   if(
$mm==$mes){
     
$opmes.='<option value="'.$mm.'" selected="selected">'.$meses[$i].'</option>';
   } else {
     
$opmes.='<option value="'.$mm.'">'.$meses[$i].'</option>';
   }
 }
 for(
$i=85;$i>0;$i--){
   
$yy=date("Y")-$i;
   if(
$yy==$year){
     
$opano.='<option value="'.$yy.'" selected="selected">'.$yy.'</option>';
   } else {
     
$opano.='<option value="'.$yy.'">'.$yy.'</option>';
   }
 }
 
$seldia.=$opdia.'</select>';
 
$selmes.=$opmes.'</select>';
 
$selano.=$opano.'</select>';
 
$html=$seldia.'-'.$selmes.'-'.$selano;
 return 
$html;



Código PHP:
<?php
include "pagina.inc.php";
?>
<html>
<head>
<title>Calculo de Fecha:</title>
</head>

<body>
<form name="form1" method="post" action="fechacal.php">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="12%" class="labeltop">Fecha:</td>
      <td width="88%"><?php echo GetSelectFechaHTML($fecha); ?></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    </tr>
    <tr>  
    <td> <input name="numero" type="text" id="numero"></td>
    </tr>
</table>    


<?php


 $guardar
=$_POST['Aceptar'];

  if (
$guardar==1){
$dia=$_POST['cb_dia'];
$mes=$_POST['cb_mes'];
$anio=$_POST['cb_ano'];
$numero=$_POST['numero'];
$fecha1 mktime(0,0,0,date("$mes"),date("$dia")+$numero,date("$anio"));
echo 
date("d/m/Y"$fecha1); 
}

?>

    <p align="center">
      <input type="button" name="Button" value="Aceptar" onClick="javascript:document.forms[0].Aceptar.value=1;this.form.submit();" >
      <input name="Aceptar" type="hidden" id="Aceptar" value="0"> 
  </p>

</form>

</body>
</html>
es lo mas paresido que buscas, eso si en esto puedes ingresar un numero, esto te lo suma o resta, dependiendo del numero...

salu2 espero que te ayude
__________________
Una Vez Muerto el Perro.............Se acaba la Rabia :risa: