Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/11/2005, 09:22
lidmartins
 
Fecha de Ingreso: octubre-2005
Mensajes: 69
Antigüedad: 18 años, 5 meses
Puntos: 0
Exclamación Manejo de fechas con ComboBox

Hola a todos.. Tengo el siguiente problemita... quiero manejar fechas en un comboBox dentro de un formulario. Tengo una fecha de alquiler desde y la otra hasta... ya llene los comboBox, pero cuando deseo seleccionar un mes que tiene 30 ó 28 dias el comboBox del día no se actualiza.. aqui le envio el codigo que tengo hasta los momentos...

Código PHP:
<html> 
<head> 
</head> 
<body>
<form name=CMSFORM method=post>
<table width=100% border=1 align=center>

<?php 
$day 
date("d");
$moth date("m");
$yeardate("Y");
$cont=0;
$cont_day=1;
$stop=32;

$array=array("Enero""Febrero""Marzo""Abril""Mayo""Junio""Julio""Agosto""Septiembre""Octubre""Noviembre""Diciembre");

?>

<!-- **** FECHA ***** -->
    <tr> 
    <td align=right><b>Fecha de alquiler:</b></td>
    <td>
         <table border=1>
          <tr>
               <td align="center" width=100><b>Desde: </b></td> 
            <td align="right"> Año: </td> 
            <td width=100> 
        <select name="a_o">
           <option value="A"><?php echo $year?></option>
           <option value="B"><?php echo $year+1?></option>
        </select> 
            </td> 
            <td align="right"> Mes: </td> 
            <td width=100> 
        <select name="mes">                
           <?php 
            
while ($cont 12) { ?>
                <option value=<?php echo $cont" "; if(($cont+1) == $moth){echo ("selected");}?>>
                                                               <?php echo $array[$cont]; 
                                                                
$cont++; }?>
            </option>                                 
        </select> 
            </td>
            <td align="right"> Día:    </td> 
            <td width=100> 
        <select name="dia">
        <?php 
           
if ($moth == 04 || $moth ==06 || $moth ==09 || $moth ==11) {
              
$stop=31;
        } 
        if (
$moth == 02) {
           
$stop=29;
        }
        while (
$cont_day $stop) { ?>
             <option value=<?php echo $cont_day" "; if(($cont_day) == $day){echo ("selected");}?>>
                                                        <?php echo $cont_day
                                                            
$cont_day++; }?>
              </option>
        </select> 
              </td> 
           </tr>
        </table>
    </td>
        </tr> 

<!-- **** FECHA ***** -->
<?php 
    $cont
=0;
    
$cont_day=1;
    
$stop=32;
?>
    <tr> 
        <td></td>
        <td>
        <table border=1>
        <tr>
            <td align="center" width=100><b>Hasta: </b></td> 
            <td align="right"> Año: </td> 
            <td width=100> 
              <select name="a_o2">
                <option value="A2"><?php echo $year?></option>
                <option value="B2"><?php echo $year+1?></option>
              </select> 
            </td> 
            <td align="right"> Mes: </td> 
            <td width=100> 
                <select name="mes2">                
                    <?php 
                        
while ($cont 12) { ?>
                            <option value="2"<?php echo $cont" "; if(($cont+1) == $moth){echo ("selected");}?>>
                                <?php echo $array[$cont]; 
                                      
$cont++; }?>
                            </option>                                 
                </select> 
            </td>
            <td align="right"> Día:    </td> 
            <td width=100>                 
                <select name="dia2">
                    <?php 
                        
if ($moth == 04 || $moth ==06 || $moth ==09 || $moth ==11) {
                            
$stop=31;
                        } 
                        if (
$moth == 02) {
                            
$stop=29;
                        }
                        while (
$cont_day $stop) { ?>
                            <option value=<?php echo $cont_day" "; if(($cont_day) == $day){echo ("selected");}?>>
                                <?php echo $cont_day
                                      
$cont_day++; }?>
                        </option>
                </select> 
            </td> 
        </tr>
        </table>
        </td>
    </tr>
<!-- **** FECHA ***** -->
</table>
</body> 
</html>
Gracias...
__________________
Ana Martins